(root)/
Python-3.12.0/
Modules/
expat/
pyexpatns.h
       1  /* Copyright (c) 2005-2006 ActiveState Software Inc.
       2   *
       3   * Namespace all expat exported symbols to avoid dynamic loading symbol
       4   * collisions when embedding Python.
       5   *
       6   * The Problem:
       7   * - you embed Python in some app
       8   * - the app dynamically loads libexpat of version X
       9   * - the embedded Python imports pyexpat (which was built against
      10   *   libexpat version X+n)
      11   * --> pyexpat gets the expat symbols from the already loaded and *older*
      12   *     libexpat: crash (Specifically the crash we observed was in
      13   *     getting an old XML_ErrorString (from xmlparse.c) and then calling
      14   *     it with newer values in the XML_Error enum:
      15   *
      16   *       // pyexpat.c, line 1970
      17   *       ...
      18   *       // Added in Expat 1.95.7.
      19   *       MYCONST(XML_ERROR_UNBOUND_PREFIX);
      20   *       ...
      21   *
      22   *
      23   * The Solution:
      24   * Prefix all exported symbols with "PyExpat_". This is similar to
      25   * what Mozilla does for some common libs:
      26   * http://lxr.mozilla.org/seamonkey/source/modules/libimg/png/mozpngconf.h#115
      27   *
      28   * The list of relevant exported symbols can be had with this command:
      29   *
      30         nm pyexpat.so \
      31             | grep -v " [a-zBUA] " \
      32             | grep -v "_fini\|_init\|initpyexpat"
      33   *
      34   * If any of those symbols are NOT prefixed with "PyExpat_" then
      35   * a #define should be added for it here.
      36   */
      37  
      38  #ifndef PYEXPATNS_H
      39  #define PYEXPATNS_H
      40  
      41  #define testingAccountingGetCountBytesDirect PyExpat_testingAccountingGetCountBytesDirect
      42  #define testingAccountingGetCountBytesIndirect PyExpat_testingAccountingGetCountBytesIndirect
      43  #define unsignedCharToPrintable PyExpat_unsignedCharToPrintable
      44  #define XML_DefaultCurrent              PyExpat_XML_DefaultCurrent
      45  #define XML_ErrorString                 PyExpat_XML_ErrorString
      46  #define XML_ExpatVersion                PyExpat_XML_ExpatVersion
      47  #define XML_ExpatVersionInfo            PyExpat_XML_ExpatVersionInfo
      48  #define XML_ExternalEntityParserCreate  PyExpat_XML_ExternalEntityParserCreate
      49  #define XML_FreeContentModel            PyExpat_XML_FreeContentModel
      50  #define XML_GetBase                     PyExpat_XML_GetBase
      51  #define XML_GetBuffer                   PyExpat_XML_GetBuffer
      52  #define XML_GetCurrentByteCount         PyExpat_XML_GetCurrentByteCount
      53  #define XML_GetCurrentByteIndex         PyExpat_XML_GetCurrentByteIndex
      54  #define XML_GetCurrentColumnNumber      PyExpat_XML_GetCurrentColumnNumber
      55  #define XML_GetCurrentLineNumber        PyExpat_XML_GetCurrentLineNumber
      56  #define XML_GetErrorCode                PyExpat_XML_GetErrorCode
      57  #define XML_GetFeatureList              PyExpat_XML_GetFeatureList
      58  #define XML_GetIdAttributeIndex         PyExpat_XML_GetIdAttributeIndex
      59  #define XML_GetInputContext             PyExpat_XML_GetInputContext
      60  #define XML_GetParsingStatus            PyExpat_XML_GetParsingStatus
      61  #define XML_GetSpecifiedAttributeCount  PyExpat_XML_GetSpecifiedAttributeCount
      62  #define XmlGetUtf16InternalEncoding     PyExpat_XmlGetUtf16InternalEncoding
      63  #define XmlGetUtf16InternalEncodingNS   PyExpat_XmlGetUtf16InternalEncodingNS
      64  #define XmlGetUtf8InternalEncoding      PyExpat_XmlGetUtf8InternalEncoding
      65  #define XmlGetUtf8InternalEncodingNS    PyExpat_XmlGetUtf8InternalEncodingNS
      66  #define XmlInitEncoding                 PyExpat_XmlInitEncoding
      67  #define XmlInitEncodingNS               PyExpat_XmlInitEncodingNS
      68  #define XmlInitUnknownEncoding          PyExpat_XmlInitUnknownEncoding
      69  #define XmlInitUnknownEncodingNS        PyExpat_XmlInitUnknownEncodingNS
      70  #define XML_MemFree                     PyExpat_XML_MemFree
      71  #define XML_MemMalloc                   PyExpat_XML_MemMalloc
      72  #define XML_MemRealloc                  PyExpat_XML_MemRealloc
      73  #define XML_Parse                       PyExpat_XML_Parse
      74  #define XML_ParseBuffer                 PyExpat_XML_ParseBuffer
      75  #define XML_ParserCreate                PyExpat_XML_ParserCreate
      76  #define XML_ParserCreate_MM             PyExpat_XML_ParserCreate_MM
      77  #define XML_ParserCreateNS              PyExpat_XML_ParserCreateNS
      78  #define XML_ParserFree                  PyExpat_XML_ParserFree
      79  #define XML_ParserReset                 PyExpat_XML_ParserReset
      80  #define XmlParseXmlDecl                 PyExpat_XmlParseXmlDecl
      81  #define XmlParseXmlDeclNS               PyExpat_XmlParseXmlDeclNS
      82  #define XmlPrologStateInit              PyExpat_XmlPrologStateInit
      83  #define XmlPrologStateInitExternalEntity    PyExpat_XmlPrologStateInitExternalEntity
      84  #define XML_ResumeParser                PyExpat_XML_ResumeParser
      85  #define XML_SetAttlistDeclHandler       PyExpat_XML_SetAttlistDeclHandler
      86  #define XML_SetBase                     PyExpat_XML_SetBase
      87  #define XML_SetBillionLaughsAttackProtectionActivationThreshold PyExpat_XML_SetBillionLaughsAttackProtectionActivationThreshold
      88  #define XML_SetBillionLaughsAttackProtectionMaximumAmplification PyExpat_XML_SetBillionLaughsAttackProtectionMaximumAmplification
      89  #define XML_SetCdataSectionHandler      PyExpat_XML_SetCdataSectionHandler
      90  #define XML_SetCharacterDataHandler     PyExpat_XML_SetCharacterDataHandler
      91  #define XML_SetCommentHandler           PyExpat_XML_SetCommentHandler
      92  #define XML_SetDefaultHandler           PyExpat_XML_SetDefaultHandler
      93  #define XML_SetDefaultHandlerExpand     PyExpat_XML_SetDefaultHandlerExpand
      94  #define XML_SetDoctypeDeclHandler       PyExpat_XML_SetDoctypeDeclHandler
      95  #define XML_SetElementDeclHandler       PyExpat_XML_SetElementDeclHandler
      96  #define XML_SetElementHandler           PyExpat_XML_SetElementHandler
      97  #define XML_SetEncoding                 PyExpat_XML_SetEncoding
      98  #define XML_SetEndCdataSectionHandler   PyExpat_XML_SetEndCdataSectionHandler
      99  #define XML_SetEndDoctypeDeclHandler    PyExpat_XML_SetEndDoctypeDeclHandler
     100  #define XML_SetEndElementHandler        PyExpat_XML_SetEndElementHandler
     101  #define XML_SetEndNamespaceDeclHandler  PyExpat_XML_SetEndNamespaceDeclHandler
     102  #define XML_SetEntityDeclHandler        PyExpat_XML_SetEntityDeclHandler
     103  #define XML_SetExternalEntityRefHandler PyExpat_XML_SetExternalEntityRefHandler
     104  #define XML_SetExternalEntityRefHandlerArg  PyExpat_XML_SetExternalEntityRefHandlerArg
     105  #define XML_SetHashSalt                 PyExpat_XML_SetHashSalt
     106  #define XML_SetNamespaceDeclHandler     PyExpat_XML_SetNamespaceDeclHandler
     107  #define XML_SetNotationDeclHandler      PyExpat_XML_SetNotationDeclHandler
     108  #define XML_SetNotStandaloneHandler     PyExpat_XML_SetNotStandaloneHandler
     109  #define XML_SetParamEntityParsing       PyExpat_XML_SetParamEntityParsing
     110  #define XML_SetProcessingInstructionHandler PyExpat_XML_SetProcessingInstructionHandler
     111  #define XML_SetReturnNSTriplet          PyExpat_XML_SetReturnNSTriplet
     112  #define XML_SetSkippedEntityHandler     PyExpat_XML_SetSkippedEntityHandler
     113  #define XML_SetStartCdataSectionHandler PyExpat_XML_SetStartCdataSectionHandler
     114  #define XML_SetStartDoctypeDeclHandler  PyExpat_XML_SetStartDoctypeDeclHandler
     115  #define XML_SetStartElementHandler      PyExpat_XML_SetStartElementHandler
     116  #define XML_SetStartNamespaceDeclHandler    PyExpat_XML_SetStartNamespaceDeclHandler
     117  #define XML_SetUnknownEncodingHandler   PyExpat_XML_SetUnknownEncodingHandler
     118  #define XML_SetUnparsedEntityDeclHandler    PyExpat_XML_SetUnparsedEntityDeclHandler
     119  #define XML_SetUserData                 PyExpat_XML_SetUserData
     120  #define XML_SetXmlDeclHandler           PyExpat_XML_SetXmlDeclHandler
     121  #define XmlSizeOfUnknownEncoding        PyExpat_XmlSizeOfUnknownEncoding
     122  #define XML_StopParser                  PyExpat_XML_StopParser
     123  #define XML_UseForeignDTD               PyExpat_XML_UseForeignDTD
     124  #define XML_UseParserAsHandlerArg       PyExpat_XML_UseParserAsHandlerArg
     125  #define XmlUtf16Encode                  PyExpat_XmlUtf16Encode
     126  #define XmlUtf8Encode                   PyExpat_XmlUtf8Encode
     127  
     128  
     129  #endif /* !PYEXPATNS_H */
     130