1
0
mirror of https://gitlab.gnome.org/GNOME/libxml2.git synced 2025-10-27 12:15:34 +03:00

globals: Don't store xmlParserVersion in global state

This is a constant.
This commit is contained in:
Nick Wellnhofer
2023-09-20 14:43:14 +02:00
parent 0830fcfa90
commit 2e6c49a74d
4 changed files with 26 additions and 10 deletions

View File

@@ -202,13 +202,6 @@ xmlPosixStrdup(const char *cur) {
xmlStrdupFunc xmlMemStrdup = xmlPosixStrdup; xmlStrdupFunc xmlMemStrdup = xmlPosixStrdup;
#endif /* DEBUG_MEMORY_LOCATION */ #endif /* DEBUG_MEMORY_LOCATION */
/**
* xmlParserVersion:
*
* Constant string describing the internal version of the library
*/
const char *xmlParserVersion = LIBXML_VERSION_STRING LIBXML_VERSION_EXTRA;
/** /**
* xmlBufferAllocScheme: * xmlBufferAllocScheme:
* *
@@ -747,7 +740,6 @@ xmlInitGlobalState(xmlGlobalStatePtr gs) {
gs->gs_xmlLineNumbersDefaultValue = xmlLineNumbersDefaultValueThrDef; gs->gs_xmlLineNumbersDefaultValue = xmlLineNumbersDefaultValueThrDef;
gs->gs_xmlLoadExtDtdDefaultValue = xmlLoadExtDtdDefaultValueThrDef; gs->gs_xmlLoadExtDtdDefaultValue = xmlLoadExtDtdDefaultValueThrDef;
gs->gs_xmlParserDebugEntities = xmlParserDebugEntitiesThrDef; gs->gs_xmlParserDebugEntities = xmlParserDebugEntitiesThrDef;
gs->gs_xmlParserVersion = LIBXML_VERSION_STRING;
gs->gs_xmlPedanticParserDefaultValue = xmlPedanticParserDefaultValueThrDef; gs->gs_xmlPedanticParserDefaultValue = xmlPedanticParserDefaultValueThrDef;
gs->gs_xmlSaveNoEmptyTags = xmlSaveNoEmptyTagsThrDef; gs->gs_xmlSaveNoEmptyTags = xmlSaveNoEmptyTagsThrDef;
gs->gs_xmlSubstituteEntitiesDefaultValue = gs->gs_xmlSubstituteEntitiesDefaultValue =
@@ -1144,5 +1136,12 @@ xmlThrDefOutputBufferCreateFilenameDefault(xmlOutputBufferCreateFilenameFunc fun
#define XML_OP XML_DEFINE_GLOBAL_WRAPPER #define XML_OP XML_DEFINE_GLOBAL_WRAPPER
XML_GLOBALS XML_GLOBALS
#undef XML_OP #undef XML_OP
/* For backward compatibility */
const char *const *
__xmlParserVersion(void) {
return &xmlParserVersion;
}
#endif #endif

View File

@@ -90,7 +90,6 @@ xmlDllMain(void *hinstDLL, unsigned long fdwReason,
#define XML_EMPTY #define XML_EMPTY
#define XML_GLOBALS_CORE \ #define XML_GLOBALS_CORE \
XML_OP(xmlParserVersion, const char *, XML_EMPTY) \
/* error handling */ \ /* error handling */ \
XML_OP(xmlLastError, xmlError, XML_DEPRECATED) \ XML_OP(xmlLastError, xmlError, XML_DEPRECATED) \
XML_OP(xmlGenericError, xmlGenericErrorFunc, XML_EMPTY) \ XML_OP(xmlGenericError, xmlGenericErrorFunc, XML_EMPTY) \
@@ -197,7 +196,6 @@ XML_GLOBALS
XML_GLOBAL_MACRO(xmlLineNumbersDefaultValue) XML_GLOBAL_MACRO(xmlLineNumbersDefaultValue)
#define xmlLoadExtDtdDefaultValue XML_GLOBAL_MACRO(xmlLoadExtDtdDefaultValue) #define xmlLoadExtDtdDefaultValue XML_GLOBAL_MACRO(xmlLoadExtDtdDefaultValue)
#define xmlParserDebugEntities XML_GLOBAL_MACRO(xmlParserDebugEntities) #define xmlParserDebugEntities XML_GLOBAL_MACRO(xmlParserDebugEntities)
#define xmlParserVersion XML_GLOBAL_MACRO(xmlParserVersion)
#define xmlPedanticParserDefaultValue \ #define xmlPedanticParserDefaultValue \
XML_GLOBAL_MACRO(xmlPedanticParserDefaultValue) XML_GLOBAL_MACRO(xmlPedanticParserDefaultValue)
#define xmlSaveNoEmptyTags XML_GLOBAL_MACRO(xmlSaveNoEmptyTags) #define xmlSaveNoEmptyTags XML_GLOBAL_MACRO(xmlSaveNoEmptyTags)

View File

@@ -805,6 +805,17 @@ typedef xmlParserInputPtr (*xmlExternalEntityLoader) (const char *URL,
const char *ID, const char *ID,
xmlParserCtxtPtr context); xmlParserCtxtPtr context);
/*
* Variables
*/
XMLPUBVAR const char *const
xmlParserVersion;
#ifdef LIBXML_THREAD_ENABLED
XMLPUBFUN const char *const *
__xmlParserVersion(void);
#endif
#ifdef __cplusplus #ifdef __cplusplus
} }
#endif #endif

View File

@@ -145,6 +145,14 @@ unsigned int xmlParserMaxDepth = 256;
*/ */
#define XML_PARSER_CHUNK_SIZE 100 #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 * List of XML prefixed PI allowed by W3C specs
*/ */