diff --git a/globals.c b/globals.c index 197139a8..632f8d38 100644 --- a/globals.c +++ b/globals.c @@ -202,13 +202,6 @@ xmlPosixStrdup(const char *cur) { xmlStrdupFunc xmlMemStrdup = xmlPosixStrdup; #endif /* DEBUG_MEMORY_LOCATION */ -/** - * xmlParserVersion: - * - * Constant string describing the internal version of the library - */ -const char *xmlParserVersion = LIBXML_VERSION_STRING LIBXML_VERSION_EXTRA; - /** * xmlBufferAllocScheme: * @@ -747,7 +740,6 @@ xmlInitGlobalState(xmlGlobalStatePtr gs) { gs->gs_xmlLineNumbersDefaultValue = xmlLineNumbersDefaultValueThrDef; gs->gs_xmlLoadExtDtdDefaultValue = xmlLoadExtDtdDefaultValueThrDef; gs->gs_xmlParserDebugEntities = xmlParserDebugEntitiesThrDef; - gs->gs_xmlParserVersion = LIBXML_VERSION_STRING; gs->gs_xmlPedanticParserDefaultValue = xmlPedanticParserDefaultValueThrDef; gs->gs_xmlSaveNoEmptyTags = xmlSaveNoEmptyTagsThrDef; gs->gs_xmlSubstituteEntitiesDefaultValue = @@ -1144,5 +1136,12 @@ xmlThrDefOutputBufferCreateFilenameDefault(xmlOutputBufferCreateFilenameFunc fun #define XML_OP XML_DEFINE_GLOBAL_WRAPPER XML_GLOBALS #undef XML_OP + + /* For backward compatibility */ + + const char *const * + __xmlParserVersion(void) { + return &xmlParserVersion; + } #endif diff --git a/include/libxml/globals.h b/include/libxml/globals.h index 3ce276dc..6cae3de2 100644 --- a/include/libxml/globals.h +++ b/include/libxml/globals.h @@ -90,7 +90,6 @@ xmlDllMain(void *hinstDLL, unsigned long fdwReason, #define XML_EMPTY #define XML_GLOBALS_CORE \ - XML_OP(xmlParserVersion, const char *, XML_EMPTY) \ /* error handling */ \ XML_OP(xmlLastError, xmlError, XML_DEPRECATED) \ XML_OP(xmlGenericError, xmlGenericErrorFunc, XML_EMPTY) \ @@ -197,7 +196,6 @@ XML_GLOBALS XML_GLOBAL_MACRO(xmlLineNumbersDefaultValue) #define xmlLoadExtDtdDefaultValue XML_GLOBAL_MACRO(xmlLoadExtDtdDefaultValue) #define xmlParserDebugEntities XML_GLOBAL_MACRO(xmlParserDebugEntities) - #define xmlParserVersion XML_GLOBAL_MACRO(xmlParserVersion) #define xmlPedanticParserDefaultValue \ XML_GLOBAL_MACRO(xmlPedanticParserDefaultValue) #define xmlSaveNoEmptyTags XML_GLOBAL_MACRO(xmlSaveNoEmptyTags) diff --git a/include/libxml/parser.h b/include/libxml/parser.h index 2b03fd40..0ddec250 100644 --- a/include/libxml/parser.h +++ b/include/libxml/parser.h @@ -805,6 +805,17 @@ typedef xmlParserInputPtr (*xmlExternalEntityLoader) (const char *URL, const char *ID, xmlParserCtxtPtr context); +/* + * Variables + */ + +XMLPUBVAR const char *const +xmlParserVersion; +#ifdef LIBXML_THREAD_ENABLED +XMLPUBFUN const char *const * +__xmlParserVersion(void); +#endif + #ifdef __cplusplus } #endif diff --git a/parser.c b/parser.c index ac9fe5c4..cce84f27 100644 --- a/parser.c +++ b/parser.c @@ -145,6 +145,14 @@ unsigned int xmlParserMaxDepth = 256; */ #define XML_PARSER_CHUNK_SIZE 100 +/** + * xmlParserVersion: + * + * Constant string describing the internal version of the library + */ +const char *const +xmlParserVersion = LIBXML_VERSION_STRING LIBXML_VERSION_EXTRA; + /* * List of XML prefixed PI allowed by W3C specs */