bpo-33956: update vendored expat to 2.2.5 (GH-7925) · python/cpython@4e21100

@@ -35,12 +35,8 @@

35353636

/* External API definitions */

373738-

/* Namespace external symbols to allow multiple libexpat version to

39-

co-exist. */

40-

#include "pyexpatns.h"

41-4238

#if defined(_MSC_EXTENSIONS) && !defined(__BEOS__) && !defined(__CYGWIN__)

43-

#define XML_USE_MSC_EXTENSIONS 1

39+

# define XML_USE_MSC_EXTENSIONS 1

4440

#endif

45414642

/* Expat tries very hard to make the API boundary very specifically

@@ -66,11 +62,11 @@

6662

system headers may assume the cdecl convention.

6763

*/

6864

#ifndef XMLCALL

69-

#if defined(_MSC_VER)

70-

#define XMLCALL __cdecl

71-

#elif defined(__GNUC__) && defined(__i386) && !defined(__INTEL_COMPILER)

72-

#define XMLCALL __attribute__((cdecl))

73-

#else

65+

# if defined(_MSC_VER)

66+

# define XMLCALL __cdecl

67+

# elif defined(__GNUC__) && defined(__i386) && !defined(__INTEL_COMPILER)

68+

# define XMLCALL __attribute__((cdecl))

69+

# else

7470

/* For any platform which uses this definition and supports more than

7571

one calling convention, we need to extend this definition to

7672

declare the convention used on that platform, if it's possible to

@@ -81,41 +77,41 @@

8177

pre-processor and how to specify the same calling convention as the

8278

platform's malloc() implementation.

8379

*/

84-

#define XMLCALL

85-

#endif

80+

# define XMLCALL

81+

# endif

8682

#endif /* not defined XMLCALL */

878388848985

#if !defined(XML_STATIC) && !defined(XMLIMPORT)

90-

#ifndef XML_BUILDING_EXPAT

86+

# ifndef XML_BUILDING_EXPAT

9187

/* using Expat from an application */

928893-

#ifdef XML_USE_MSC_EXTENSIONS

94-

#define XMLIMPORT __declspec(dllimport)

95-

#endif

89+

# ifdef XML_USE_MSC_EXTENSIONS

90+

# define XMLIMPORT __declspec(dllimport)

91+

# endif

969297-

#endif

93+

# endif

9894

#endif /* not defined XML_STATIC */

999510096

#if !defined(XMLIMPORT) && defined(__GNUC__) && (__GNUC__ >= 4)

101-

#define XMLIMPORT __attribute__ ((visibility ("default")))

97+

# define XMLIMPORT __attribute__ ((visibility ("default")))

10298

#endif

10399104100

/* If we didn't define it above, define it away: */

105101

#ifndef XMLIMPORT

106-

#define XMLIMPORT

102+

# define XMLIMPORT

107103

#endif

108104109105

#if defined(__GNUC__) && (__GNUC__ > 2 || (__GNUC__ == 2 && __GNUC_MINOR__ >= 96))

110-

#define XML_ATTR_MALLOC __attribute__((__malloc__))

106+

# define XML_ATTR_MALLOC __attribute__((__malloc__))

111107

#else

112-

#define XML_ATTR_MALLOC

108+

# define XML_ATTR_MALLOC

113109

#endif

114110115111

#if defined(__GNUC__) && ((__GNUC__ > 4) || (__GNUC__ == 4 && __GNUC_MINOR__ >= 3))

116-

#define XML_ATTR_ALLOC_SIZE(x) __attribute__((__alloc_size__(x)))

112+

# define XML_ATTR_ALLOC_SIZE(x) __attribute__((__alloc_size__(x)))

117113

#else

118-

#define XML_ATTR_ALLOC_SIZE(x)

114+

# define XML_ATTR_ALLOC_SIZE(x)

119115

#endif

120116121117

#define XMLPARSEAPI(type) XMLIMPORT type XMLCALL

@@ -125,33 +121,35 @@ extern "C" {

125121

#endif

126122127123

#ifdef XML_UNICODE_WCHAR_T

128-

# define XML_UNICODE

124+

# ifndef XML_UNICODE

125+

# define XML_UNICODE

126+

# endif

129127

# if defined(__SIZEOF_WCHAR_T__) && (__SIZEOF_WCHAR_T__ != 2)

130128

# error "sizeof(wchar_t) != 2; Need -fshort-wchar for both Expat and libc"

131129

# endif

132130

#endif

133131134132

#ifdef XML_UNICODE /* Information is UTF-16 encoded. */

135-

#ifdef XML_UNICODE_WCHAR_T

133+

# ifdef XML_UNICODE_WCHAR_T

136134

typedef wchar_t XML_Char;

137135

typedef wchar_t XML_LChar;

138-

#else

136+

# else

139137

typedef unsigned short XML_Char;

140138

typedef char XML_LChar;

141-

#endif /* XML_UNICODE_WCHAR_T */

139+

# endif /* XML_UNICODE_WCHAR_T */

142140

#else /* Information is UTF-8 encoded. */

143141

typedef char XML_Char;

144142

typedef char XML_LChar;

145143

#endif /* XML_UNICODE */

146144147145

#ifdef XML_LARGE_SIZE /* Use large integers for file/stream positions. */

148-

#if defined(XML_USE_MSC_EXTENSIONS) && _MSC_VER < 1400

146+

# if defined(XML_USE_MSC_EXTENSIONS) && _MSC_VER < 1400

149147

typedef __int64 XML_Index;

150148

typedef unsigned __int64 XML_Size;

151-

#else

149+

# else

152150

typedef long long XML_Index;

153151

typedef unsigned long long XML_Size;

154-

#endif

152+

# endif

155153

#else

156154

typedef long XML_Index;

157155

typedef unsigned long XML_Size;