diff options
author | Nick Wellnhofer <wellnhofer@aevum.de> | 2022-03-06 13:55:48 +0100 |
---|---|---|
committer | Nick Wellnhofer <wellnhofer@aevum.de> | 2022-03-06 15:59:43 +0100 |
commit | 40483d0ce26119fd3b23aea6cce532a8a78670cf (patch) | |
tree | 5436f5b1ca0065942f83a6a4be2c3a92acbcf07c | |
parent | 7d02c7291f5c0ba56b9d8c04af7690cf11e47f07 (diff) | |
download | libxml2-40483d0ce26119fd3b23aea6cce532a8a78670cf.tar.gz |
Deprecate module init and cleanup functions
These functions shouldn't be part of the public API. Most init
functions are only thread-safe when called from xmlInitParser. Global
variables should only be cleaned up by calling xmlCleanupParser.
-rw-r--r-- | HTMLparser.c | 3 | ||||
-rw-r--r-- | SAX2.c | 6 | ||||
-rw-r--r-- | dict.c | 9 | ||||
-rw-r--r-- | encoding.c | 8 | ||||
-rw-r--r-- | globals.c | 8 | ||||
-rw-r--r-- | include/libxml/SAX2.h | 2 | ||||
-rw-r--r-- | include/libxml/dict.h | 2 | ||||
-rw-r--r-- | include/libxml/encoding.h | 2 | ||||
-rw-r--r-- | include/libxml/globals.h | 2 | ||||
-rw-r--r-- | include/libxml/parserInternals.h | 1 | ||||
-rw-r--r-- | include/libxml/relaxng.h | 2 | ||||
-rw-r--r-- | include/libxml/threads.h | 2 | ||||
-rw-r--r-- | include/libxml/xmlmemory.h | 2 | ||||
-rw-r--r-- | include/libxml/xmlschemastypes.h | 2 | ||||
-rw-r--r-- | include/libxml/xpath.h | 1 | ||||
-rwxr-xr-x | python/generator.py | 14 | ||||
-rw-r--r-- | relaxng.c | 8 | ||||
-rw-r--r-- | threads.c | 8 | ||||
-rw-r--r-- | xmlmemory.c | 8 | ||||
-rw-r--r-- | xmlschemastypes.c | 8 | ||||
-rw-r--r-- | xpath.c | 3 |
21 files changed, 100 insertions, 1 deletions
diff --git a/HTMLparser.c b/HTMLparser.c index 9ea6c3d7..9bd0fb34 100644 --- a/HTMLparser.c +++ b/HTMLparser.c @@ -1394,6 +1394,9 @@ static const elementPriority htmlEndPriority[] = { /** * htmlInitAutoClose: * + * DEPRECATED: This function will be made private. Call xmlInitParser to + * initialize the library. + * * This is a no-op now. */ void @@ -2928,6 +2928,9 @@ xmlSAX2InitDefaultSAXHandler(xmlSAXHandler *hdlr, int warning) /** * xmlDefaultSAXHandlerInit: * + * DEPRECATED: This function will be made private. Call xmlInitParser to + * initialize the library. + * * Initialize the default SAX2 handler */ void @@ -2986,6 +2989,9 @@ xmlSAX2InitHtmlDefaultSAXHandler(xmlSAXHandler *hdlr) /** * htmlDefaultSAXHandlerInit: * + * DEPRECATED: This function will be made private. Call xmlInitParser to + * initialize the library. + * * Initialize the default SAX handler */ void @@ -146,8 +146,10 @@ static unsigned int rand_seed = 0; /** * xmlInitializeDict: * + * DEPRECATED: This function will be made private. Call xmlInitParser to + * initialize the library. + * * Do the dictionary mutex initialization. - * this function is deprecated * * Returns 0 if initialization was already done, and 1 if that * call led to the initialization @@ -210,6 +212,11 @@ int __xmlRandom(void) { /** * xmlDictCleanup: * + * DEPRECATED: This function will be made private. Call xmlCleanupParser + * to free global state but see the warnings there. xmlCleanupParser + * should be only called once at program exit. In most cases, you don't + * have call cleanup functions at all. + * * Free the dictionary mutex. Do not call unless sure the library * is not in use anymore ! */ @@ -1408,6 +1408,9 @@ xmlNewCharEncodingHandler(const char *name, /** * xmlInitCharEncodingHandlers: * + * DEPRECATED: This function will be made private. Call xmlInitParser to + * initialize the library. + * * Initialize the char encoding support, it registers the default * encoding supported. * NOTE: while public, this function usually doesn't need to be called @@ -1468,6 +1471,11 @@ xmlInitCharEncodingHandlers(void) { /** * xmlCleanupCharEncodingHandlers: * + * DEPRECATED: This function will be made private. Call xmlCleanupParser + * to free global state but see the warnings there. xmlCleanupParser + * should be only called once at program exit. In most cases, you don't + * have call cleanup functions at all. + * * Cleanup the memory allocated for the char encoding support, it * unregisters all the encoding handlers and the aliases. */ @@ -40,6 +40,9 @@ static xmlMutexPtr xmlThrDefMutex = NULL; /** * xmlInitGlobals: * + * DEPRECATED: This function will be made private. Call xmlInitParser to + * initialize the library. + * * Additional initialisation for multi-threading */ void xmlInitGlobals(void) @@ -522,6 +525,11 @@ xmlInitializeGlobalState(xmlGlobalStatePtr gs) /** * xmlCleanupGlobals: * + * DEPRECATED: This function will be made private. Call xmlCleanupParser + * to free global state but see the warnings there. xmlCleanupParser + * should be only called once at program exit. In most cases, you don't + * have call cleanup functions at all. + * * Additional cleanup for multi-threading */ void xmlCleanupGlobals(void) diff --git a/include/libxml/SAX2.h b/include/libxml/SAX2.h index 25047914..8e9b0b95 100644 --- a/include/libxml/SAX2.h +++ b/include/libxml/SAX2.h @@ -159,9 +159,11 @@ XMLPUBFUN void XMLCALL #ifdef LIBXML_HTML_ENABLED XMLPUBFUN void XMLCALL xmlSAX2InitHtmlDefaultSAXHandler(xmlSAXHandler *hdlr); +XML_DEPRECATED XMLPUBFUN void XMLCALL htmlDefaultSAXHandlerInit (void); #endif +XML_DEPRECATED XMLPUBFUN void XMLCALL xmlDefaultSAXHandlerInit (void); #ifdef __cplusplus diff --git a/include/libxml/dict.h b/include/libxml/dict.h index cf54af1f..91f74d1b 100644 --- a/include/libxml/dict.h +++ b/include/libxml/dict.h @@ -27,6 +27,7 @@ typedef xmlDict *xmlDictPtr; /* * Initializer */ +XML_DEPRECATED XMLPUBFUN int XMLCALL xmlInitializeDict(void); /* @@ -70,6 +71,7 @@ XMLPUBFUN int XMLCALL /* * Cleanup function */ +XML_DEPRECATED XMLPUBFUN void XMLCALL xmlDictCleanup (void); diff --git a/include/libxml/encoding.h b/include/libxml/encoding.h index 77f137f4..381e1886 100644 --- a/include/libxml/encoding.h +++ b/include/libxml/encoding.h @@ -153,8 +153,10 @@ extern "C" { /* * Interfaces for encoding handlers. */ +XML_DEPRECATED XMLPUBFUN void XMLCALL xmlInitCharEncodingHandlers (void); +XML_DEPRECATED XMLPUBFUN void XMLCALL xmlCleanupCharEncodingHandlers (void); XMLPUBFUN void XMLCALL diff --git a/include/libxml/globals.h b/include/libxml/globals.h index 40815217..d57ccb05 100644 --- a/include/libxml/globals.h +++ b/include/libxml/globals.h @@ -24,7 +24,9 @@ extern "C" { #endif +XML_DEPRECATED XMLPUBFUN void XMLCALL xmlInitGlobals(void); +XML_DEPRECATED XMLPUBFUN void XMLCALL xmlCleanupGlobals(void); /** diff --git a/include/libxml/parserInternals.h b/include/libxml/parserInternals.h index 9f3c76f2..0615f084 100644 --- a/include/libxml/parserInternals.h +++ b/include/libxml/parserInternals.h @@ -574,6 +574,7 @@ XMLPUBFUN void XMLCALL xmlParserInputShrink (xmlParserInputPtr in); /* * Actually comes from the HTML parser but launched from the init stuff. */ +XML_DEPRECATED XMLPUBFUN void XMLCALL htmlInitAutoClose (void); XMLPUBFUN htmlParserCtxtPtr XMLCALL htmlCreateFileParserCtxt(const char *filename, const char *encoding); diff --git a/include/libxml/relaxng.h b/include/libxml/relaxng.h index f269c9ec..89f9d381 100644 --- a/include/libxml/relaxng.h +++ b/include/libxml/relaxng.h @@ -116,8 +116,10 @@ typedef enum { XML_RELAXNGP_CRNG = 2 } xmlRelaxNGParserFlag; +XML_DEPRECATED XMLPUBFUN int XMLCALL xmlRelaxNGInitTypes (void); +XML_DEPRECATED XMLPUBFUN void XMLCALL xmlRelaxNGCleanupTypes (void); diff --git a/include/libxml/threads.h b/include/libxml/threads.h index 9969ae7c..6eedac1f 100644 --- a/include/libxml/threads.h +++ b/include/libxml/threads.h @@ -57,6 +57,7 @@ XMLPUBFUN void XMLCALL /* * Library wide APIs. */ +XML_DEPRECATED XMLPUBFUN void XMLCALL xmlInitThreads (void); XMLPUBFUN void XMLCALL @@ -67,6 +68,7 @@ XMLPUBFUN int XMLCALL xmlGetThreadId (void); XMLPUBFUN int XMLCALL xmlIsMainThread (void); +XML_DEPRECATED XMLPUBFUN void XMLCALL xmlCleanupThreads(void); XMLPUBFUN xmlGlobalStatePtr XMLCALL diff --git a/include/libxml/xmlmemory.h b/include/libxml/xmlmemory.h index 17e375a3..ae2a4275 100644 --- a/include/libxml/xmlmemory.h +++ b/include/libxml/xmlmemory.h @@ -126,12 +126,14 @@ XMLPUBFUN int XMLCALL /* * Initialization of the memory layer. */ +XML_DEPRECATED XMLPUBFUN int XMLCALL xmlInitMemory (void); /* * Cleanup of the memory layer. */ +XML_DEPRECATED XMLPUBFUN void XMLCALL xmlCleanupMemory (void); /* diff --git a/include/libxml/xmlschemastypes.h b/include/libxml/xmlschemastypes.h index 35d48d41..2a09a6e5 100644 --- a/include/libxml/xmlschemastypes.h +++ b/include/libxml/xmlschemastypes.h @@ -30,8 +30,10 @@ typedef enum { XML_SCHEMA_WHITESPACE_COLLAPSE = 3 } xmlSchemaWhitespaceValueType; +XML_DEPRECATED XMLPUBFUN void XMLCALL xmlSchemaInitTypes (void); +XML_DEPRECATED XMLPUBFUN void XMLCALL xmlSchemaCleanupTypes (void); XMLPUBFUN xmlSchemaTypePtr XMLCALL diff --git a/include/libxml/xpath.h b/include/libxml/xpath.h index 539593fa..a6e36448 100644 --- a/include/libxml/xpath.h +++ b/include/libxml/xpath.h @@ -549,6 +549,7 @@ XMLPUBFUN void XMLCALL xmlXPathFreeCompExpr (xmlXPathCompExprPtr comp); #endif /* LIBXML_XPATH_ENABLED */ #if defined(LIBXML_XPATH_ENABLED) || defined(LIBXML_SCHEMAS_ENABLED) +XML_DEPRECATED XMLPUBFUN void XMLCALL xmlXPathInit (void); XMLPUBFUN int XMLCALL diff --git a/python/generator.py b/python/generator.py index b885827b..06ab655f 100755 --- a/python/generator.py +++ b/python/generator.py @@ -289,8 +289,22 @@ skip_impl = ( ) deprecated_funcs = { + 'htmlDefaultSAXHandlerInit': True, + 'htmlInitAutoClose': True, + 'xmlCleanupCharEncodingHandlers': True, + 'xmlCleanupGlobals': True, + 'xmlDefaultSAXHandlerInit': True, + 'xmlDictCleanup': True, + 'xmlInitCharEncodingHandlers': True, + 'xmlInitGlobals': True, + 'xmlInitializeDict': True, 'xmlIsRef': True, + 'xmlRelaxNGCleanupTypes': True, + 'xmlRelaxNGInitTypes': True, 'xmlRemoveRef': True, + 'xmlSchemaCleanupTypes': True, + 'xmlSchemaInitTypes': True, + 'xmlXPathInit': True, } def skip_function(name): @@ -2815,6 +2815,9 @@ xmlRelaxNGRegisterTypeLibrary(const xmlChar * namespace, void *data, /** * xmlRelaxNGInitTypes: * + * DEPRECATED: This function will be made private. Call xmlInitParser to + * initialize the library. + * * Initialize the default type libraries. * * Returns 0 in case of success and -1 in case of error. @@ -2849,6 +2852,11 @@ xmlRelaxNGInitTypes(void) /** * xmlRelaxNGCleanupTypes: * + * DEPRECATED: This function will be made private. Call xmlCleanupParser + * to free global state but see the warnings there. xmlCleanupParser + * should be only called once at program exit. In most cases, you don't + * have call cleanup functions at all. + * * Cleanup the default Schemas type library associated to RelaxNG */ void @@ -843,6 +843,9 @@ xmlUnlockLibrary(void) /** * xmlInitThreads: * + * DEPRECATED: This function will be made private. Call xmlInitParser to + * initialize the library. + * * xmlInitThreads() is used to to initialize all the thread related * data of the libxml2 library. */ @@ -883,6 +886,11 @@ xmlInitThreads(void) /** * xmlCleanupThreads: * + * DEPRECATED: This function will be made private. Call xmlCleanupParser + * to free global state but see the warnings there. xmlCleanupParser + * should be only called once at program exit. In most cases, you don't + * have call cleanup functions at all. + * * xmlCleanupThreads() is used to to cleanup all the thread related * data of the libxml2 library once processing has ended. * diff --git a/xmlmemory.c b/xmlmemory.c index 8f74e6e6..892d50c3 100644 --- a/xmlmemory.c +++ b/xmlmemory.c @@ -935,6 +935,9 @@ xmlMemoryDump(void) /** * xmlInitMemory: * + * DEPRECATED: This function will be made private. Call xmlInitParser to + * initialize the library. + * * Initialize the memory layer. * * Returns 0 on success @@ -974,6 +977,11 @@ xmlInitMemory(void) /** * xmlCleanupMemory: * + * DEPRECATED: This function will be made private. Call xmlCleanupParser + * to free global state but see the warnings there. xmlCleanupParser + * should be only called once at program exit. In most cases, you don't + * have call cleanup functions at all. + * * Free up all the memory allocated by the library for its own * use. This should not be called by user level code. */ diff --git a/xmlschemastypes.c b/xmlschemastypes.c index 5d588eea..3aae92c4 100644 --- a/xmlschemastypes.c +++ b/xmlschemastypes.c @@ -386,6 +386,9 @@ xmlSchemaAddParticle(void) /* * xmlSchemaInitTypes: * + * DEPRECATED: This function will be made private. Call xmlInitParser to + * initialize the library. + * * Initialize the default XML Schemas type library */ void @@ -623,6 +626,11 @@ xmlSchemaFreeTypeEntry(void *type, const xmlChar *name ATTRIBUTE_UNUSED) { /** * xmlSchemaCleanupTypes: * + * DEPRECATED: This function will be made private. Call xmlCleanupParser + * to free global state but see the warnings there. xmlCleanupParser + * should be only called once at program exit. In most cases, you don't + * have call cleanup functions at all. + * * Cleanup the default XML Schemas type library */ void @@ -482,6 +482,9 @@ double xmlXPathNINF; /** * xmlXPathInit: * + * DEPRECATED: This function will be made private. Call xmlInitParser to + * initialize the library. + * * Initialize the XPath environment */ ATTRIBUTE_NO_SANITIZE("float-divide-by-zero") |