1
0
mirror of https://gitlab.gnome.org/GNOME/libxml2.git synced 2025-10-26 00:37:43 +03:00

parser: Don't call *DefaultSAXHandlerInit from xmlInitParser

Change the default handler definitions to match the result after calling
the initialization functions.

This makes sure that no thread-local variables are accessed when calling
xmlInitParser.
This commit is contained in:
Nick Wellnhofer
2022-11-24 16:38:47 +01:00
parent 1406b20fe9
commit cecd364dd2
3 changed files with 5 additions and 15 deletions

12
SAX2.c
View File

@@ -2937,7 +2937,7 @@ xmlSAX2InitDefaultSAXHandler(xmlSAXHandler *hdlr, int warning)
/** /**
* xmlDefaultSAXHandlerInit: * xmlDefaultSAXHandlerInit:
* *
* DEPRECATED: This function will be made private. Call xmlInitParser to * DEPRECATED: This function is a no-op. Call xmlInitParser to
* initialize the library. * initialize the library.
* *
* Initialize the default SAX2 handler * Initialize the default SAX2 handler
@@ -2945,9 +2945,6 @@ xmlSAX2InitDefaultSAXHandler(xmlSAXHandler *hdlr, int warning)
void void
xmlDefaultSAXHandlerInit(void) xmlDefaultSAXHandlerInit(void)
{ {
#ifdef LIBXML_SAX1_ENABLED
xmlSAXVersion((xmlSAXHandlerPtr) &xmlDefaultSAXHandler, 1);
#endif /* LIBXML_SAX1_ENABLED */
} }
#ifdef LIBXML_HTML_ENABLED #ifdef LIBXML_HTML_ENABLED
@@ -2998,17 +2995,12 @@ xmlSAX2InitHtmlDefaultSAXHandler(xmlSAXHandler *hdlr)
/** /**
* htmlDefaultSAXHandlerInit: * htmlDefaultSAXHandlerInit:
* *
* DEPRECATED: This function will be made private. Call xmlInitParser to * DEPRECATED: This function is a no-op. Call xmlInitParser to
* initialize the library. * initialize the library.
*
* Initialize the default SAX handler
*/ */
void void
htmlDefaultSAXHandlerInit(void) htmlDefaultSAXHandlerInit(void)
{ {
#ifdef LIBXML_SAX1_ENABLED
xmlSAX2InitHtmlDefaultSAXHandler((xmlSAXHandlerPtr) &htmlDefaultSAXHandler);
#endif
} }
#endif /* LIBXML_HTML_ENABLED */ #endif /* LIBXML_HTML_ENABLED */

View File

@@ -427,7 +427,7 @@ xmlSAXHandlerV1 xmlDefaultSAXHandler = {
xmlSAX2GetParameterEntity, xmlSAX2GetParameterEntity,
xmlSAX2CDataBlock, xmlSAX2CDataBlock,
xmlSAX2ExternalSubset, xmlSAX2ExternalSubset,
0, 1,
}; };
#endif /* LIBXML_SAX1_ENABLED */ #endif /* LIBXML_SAX1_ENABLED */
@@ -480,10 +480,10 @@ xmlSAXHandlerV1 htmlDefaultSAXHandler = {
xmlParserWarning, xmlParserWarning,
xmlParserError, xmlParserError,
xmlParserError, xmlParserError,
xmlSAX2GetParameterEntity, NULL,
xmlSAX2CDataBlock, xmlSAX2CDataBlock,
NULL, NULL,
0, 1,
}; };
#endif /* LIBXML_HTML_ENABLED */ #endif /* LIBXML_HTML_ENABLED */

View File

@@ -14498,14 +14498,12 @@ xmlInitParser(void) {
xmlInitMemory(); xmlInitMemory();
xmlInitializeDict(); xmlInitializeDict();
xmlInitCharEncodingHandlers(); xmlInitCharEncodingHandlers();
xmlDefaultSAXHandlerInit();
xmlRegisterDefaultInputCallbacks(); xmlRegisterDefaultInputCallbacks();
#ifdef LIBXML_OUTPUT_ENABLED #ifdef LIBXML_OUTPUT_ENABLED
xmlRegisterDefaultOutputCallbacks(); xmlRegisterDefaultOutputCallbacks();
#endif /* LIBXML_OUTPUT_ENABLED */ #endif /* LIBXML_OUTPUT_ENABLED */
#ifdef LIBXML_HTML_ENABLED #ifdef LIBXML_HTML_ENABLED
htmlInitAutoClose(); htmlInitAutoClose();
htmlDefaultSAXHandlerInit();
#endif #endif
#if defined(LIBXML_XPATH_ENABLED) || defined(LIBXML_SCHEMAS_ENABLED) #if defined(LIBXML_XPATH_ENABLED) || defined(LIBXML_SCHEMAS_ENABLED)
xmlXPathInit(); xmlXPathInit();