Skip to content

Commit

Permalink
closes bpo-37437: Update vendorized expat to 2.2.7. (GH-14436)
Browse files Browse the repository at this point in the history
(cherry picked from commit 3b03b09)

Co-authored-by: Benjamin Peterson <benjamin@python.org>
  • Loading branch information
2 people authored and ned-deily committed Jul 2, 2019
1 parent 3d99637 commit cc0bf97
Show file tree
Hide file tree
Showing 7 changed files with 22 additions and 32 deletions.
@@ -0,0 +1 @@
Update vendorized expat version to 2.2.7.
2 changes: 1 addition & 1 deletion Modules/expat/expat.h
Expand Up @@ -1076,7 +1076,7 @@ XML_GetFeatureList(void);
*/
#define XML_MAJOR_VERSION 2
#define XML_MINOR_VERSION 2
#define XML_MICRO_VERSION 6
#define XML_MICRO_VERSION 7

#ifdef __cplusplus
}
Expand Down
10 changes: 5 additions & 5 deletions Modules/expat/expat_external.h
Expand Up @@ -35,10 +35,6 @@

/* External API definitions */

/* Namespace external symbols to allow multiple libexpat version to
co-exist. */
#include "pyexpatns.h"

#if defined(_MSC_EXTENSIONS) && !defined(__BEOS__) && !defined(__CYGWIN__)
# define XML_USE_MSC_EXTENSIONS 1
#endif
Expand Down Expand Up @@ -97,7 +93,11 @@
# endif
#endif /* not defined XML_STATIC */

#if !defined(XMLIMPORT) && defined(__GNUC__) && (__GNUC__ >= 4)
#ifndef XML_ENABLE_VISIBILITY
# define XML_ENABLE_VISIBILITY 0
#endif

#if !defined(XMLIMPORT) && XML_ENABLE_VISIBILITY
# define XMLIMPORT __attribute__ ((visibility ("default")))
#endif

Expand Down
5 changes: 5 additions & 0 deletions Modules/expat/internal.h
Expand Up @@ -115,6 +115,11 @@ extern "C" {
#endif


#ifdef XML_ENABLE_VISIBILITY
#if XML_ENABLE_VISIBILITY
__attribute__ ((visibility ("default")))
#endif
#endif
void
_INTERNAL_trim_to_complete_utf8_characters(const char * from, const char ** fromLimRef);

Expand Down
4 changes: 0 additions & 4 deletions Modules/expat/winconfig.h
Expand Up @@ -53,10 +53,6 @@
/* we will assume all Windows platforms are little endian */
#define BYTEORDER 1234

/* Windows has memmove() available. */
#define HAVE_MEMMOVE


#endif /* !defined(HAVE_EXPAT_CONFIG_H) */


Expand Down
29 changes: 10 additions & 19 deletions Modules/expat/xmlparse.c
@@ -1,4 +1,4 @@
/* 19ac4776051591216f1874e34ee99b6a43a3784c8bd7d70efeb9258dd22b906a (2.2.6+)
/* 69df5be70289a11fb834869ce4a91c23c1d9dd04baffcbd10e86742d149a080c (2.2.7+)
__ __ _
___\ \/ /_ __ __ _| |_
/ _ \\ /| '_ \ / _` | __|
Expand Down Expand Up @@ -164,15 +164,6 @@ typedef char ICHAR;
/* Do safe (NULL-aware) pointer arithmetic */
#define EXPAT_SAFE_PTR_DIFF(p, q) (((p) && (q)) ? ((p) - (q)) : 0)

/* Handle the case where memmove() doesn't exist. */
#ifndef HAVE_MEMMOVE
#ifdef HAVE_BCOPY
#define memmove(d,s,l) bcopy((s),(d),(l))
#else
#error memmove does not exist on this platform, nor is a substitute available
#endif /* HAVE_BCOPY */
#endif /* HAVE_MEMMOVE */

#include "internal.h"
#include "xmltok.h"
#include "xmlrole.h"
Expand Down Expand Up @@ -747,7 +738,7 @@ writeRandomBytes_dev_urandom(void * target, size_t count) {
#endif /* ! defined(HAVE_ARC4RANDOM_BUF) && ! defined(HAVE_ARC4RANDOM) */


#if defined(HAVE_ARC4RANDOM)
#if defined(HAVE_ARC4RANDOM) && ! defined(HAVE_ARC4RANDOM_BUF)

static void
writeRandomBytes_arc4random(void * target, size_t count) {
Expand All @@ -765,7 +756,7 @@ writeRandomBytes_arc4random(void * target, size_t count) {
}
}

#endif /* defined(HAVE_ARC4RANDOM) */
#endif /* defined(HAVE_ARC4RANDOM) && ! defined(HAVE_ARC4RANDOM_BUF) */


#ifdef _WIN32
Expand Down Expand Up @@ -3019,7 +3010,7 @@ doContent(XML_Parser parser,
enum XML_Error result;
if (parser->m_startCdataSectionHandler)
parser->m_startCdataSectionHandler(parser->m_handlerArg);
#if 0
/* BEGIN disabled code */
/* Suppose you doing a transformation on a document that involves
changing only the character data. You set up a defaultHandler
and a characterDataHandler. The defaultHandler simply copies
Expand All @@ -3032,9 +3023,9 @@ doContent(XML_Parser parser,
However, now we have a start/endCdataSectionHandler, so it seems
easier to let the user deal with this.
*/
else if (parser->m_characterDataHandler)
else if (0 && parser->m_characterDataHandler)
parser->m_characterDataHandler(parser->m_handlerArg, parser->m_dataBuf, 0);
#endif
/* END disabled code */
else if (parser->m_defaultHandler)
reportDefault(parser, enc, s, next);
result = doCdataSection(parser, enc, &next, end, nextPtr, haveMore);
Expand Down Expand Up @@ -3731,11 +3722,11 @@ doCdataSection(XML_Parser parser,
case XML_TOK_CDATA_SECT_CLOSE:
if (parser->m_endCdataSectionHandler)
parser->m_endCdataSectionHandler(parser->m_handlerArg);
#if 0
/* BEGIN disabled code */
/* see comment under XML_TOK_CDATA_SECT_OPEN */
else if (parser->m_characterDataHandler)
else if (0 && parser->m_characterDataHandler)
parser->m_characterDataHandler(parser->m_handlerArg, parser->m_dataBuf, 0);
#endif
/* END disabled code */
else if (parser->m_defaultHandler)
reportDefault(parser, enc, s, next);
*startPtr = next;
Expand Down Expand Up @@ -6080,7 +6071,7 @@ setElementTypePrefix(XML_Parser parser, ELEMENT_TYPE *elementType)
else
poolDiscard(&dtd->pool);
elementType->prefix = prefix;

break;
}
}
return 1;
Expand Down
3 changes: 0 additions & 3 deletions Modules/expat/xmltok.c
Expand Up @@ -30,9 +30,6 @@
USE OR OTHER DEALINGS IN THE SOFTWARE.
*/

#if !defined(_WIN32) && defined(HAVE_EXPAT_CONFIG_H)
# include <pyconfig.h>
#endif
#include <stddef.h>
#include <string.h> /* memcpy */

Expand Down

0 comments on commit cc0bf97

Please sign in to comment.