From d6ba403368931a2eb4466388fa634c0605992302 Mon Sep 17 00:00:00 2001 From: Nick Wellnhofer Date: Wed, 20 Sep 2023 20:49:59 +0200 Subject: [PATCH] globals: Move remaining declarations to correct places globals.h is now deprecated. Sanity is restored. --- include/libxml/globals.h | 64 +++++---------------------------------- include/libxml/parser.h | 16 ++++++++++ include/libxml/threads.h | 12 ++++++++ include/libxml/tree.h | 9 ++++++ include/libxml/xmlIO.h | 6 ++++ include/libxml/xmlerror.h | 6 ++++ include/libxml/xmlsave.h | 8 +++++ python/libxml.c | 1 - python/libxml_wrap.h | 1 + testThreads.c | 1 - 10 files changed, 66 insertions(+), 58 deletions(-) diff --git a/include/libxml/globals.h b/include/libxml/globals.h index b7a00aca..29e51922 100644 --- a/include/libxml/globals.h +++ b/include/libxml/globals.h @@ -1,22 +1,26 @@ /* * Summary: interface for all global variables of the library - * Description: all the global variables and thread handling for - * those variables is handled by this module. + * Description: Deprecated, don't use * * Copy: See Copyright for the status of this software. - * - * Author: Gary Pennington , Daniel Veillard */ #ifndef __XML_GLOBALS_H #define __XML_GLOBALS_H #include + +/* + * This file was required to access global variables until version v2.12.0. + * + * These includes are for backward compatibility. + */ #include #include #include #include #include +#include #ifdef __cplusplus extern "C" { @@ -25,9 +29,6 @@ extern "C" { typedef struct _xmlGlobalState xmlGlobalState; typedef xmlGlobalState *xmlGlobalStatePtr; -XMLPUBFUN int -xmlCheckThreadLocalStorage(void); - XML_DEPRECATED XMLPUBFUN void xmlInitGlobals(void); XML_DEPRECATED XMLPUBFUN void @@ -37,55 +38,6 @@ xmlInitializeGlobalState(xmlGlobalStatePtr gs); XML_DEPRECATED XMLPUBFUN xmlGlobalStatePtr xmlGetGlobalState(void); -XMLPUBFUN void -xmlThrDefSetGenericErrorFunc(void *ctx, xmlGenericErrorFunc handler); -XMLPUBFUN void -xmlThrDefSetStructuredErrorFunc(void *ctx, xmlStructuredErrorFunc handler); -XMLPUBFUN int -xmlThrDefIndentTreeOutput(int v); -XMLPUBFUN const char * -xmlThrDefTreeIndentString(const char * v); -XMLPUBFUN int -xmlThrDefSaveNoEmptyTags(int v); -XML_DEPRECATED XMLPUBFUN xmlBufferAllocationScheme -xmlThrDefBufferAllocScheme(xmlBufferAllocationScheme v); -XML_DEPRECATED XMLPUBFUN int -xmlThrDefDefaultBufferSize(int v); -XML_DEPRECATED XMLPUBFUN int -xmlThrDefDoValidityCheckingDefaultValue(int v); -XML_DEPRECATED XMLPUBFUN int -xmlThrDefGetWarningsDefaultValue(int v); -XML_DEPRECATED XMLPUBFUN int -xmlThrDefKeepBlanksDefaultValue(int v); -XML_DEPRECATED XMLPUBFUN int -xmlThrDefLineNumbersDefaultValue(int v); -XML_DEPRECATED XMLPUBFUN int -xmlThrDefLoadExtDtdDefaultValue(int v); -XML_DEPRECATED XMLPUBFUN int -xmlThrDefParserDebugEntities(int v); -XML_DEPRECATED XMLPUBFUN int -xmlThrDefPedanticParserDefaultValue(int v); -XML_DEPRECATED XMLPUBFUN int -xmlThrDefSubstituteEntitiesDefaultValue(int v); -XMLPUBFUN xmlRegisterNodeFunc -xmlThrDefRegisterNodeDefault(xmlRegisterNodeFunc func); -XMLPUBFUN xmlDeregisterNodeFunc -xmlThrDefDeregisterNodeDefault(xmlDeregisterNodeFunc func); -XMLPUBFUN xmlOutputBufferCreateFilenameFunc -xmlThrDefOutputBufferCreateFilenameDefault(xmlOutputBufferCreateFilenameFunc func); -XMLPUBFUN xmlParserInputBufferCreateFilenameFunc -xmlThrDefParserInputBufferCreateFilenameDefault( - xmlParserInputBufferCreateFilenameFunc func); - -/** DOC_DISABLE */ -#if defined(LIBXML_THREAD_ENABLED) && defined(_WIN32) && \ - defined(LIBXML_STATIC_FOR_DLL) -int -xmlDllMain(void *hinstDLL, unsigned long fdwReason, - void *lpvReserved); -#endif -/** DOC_ENABLE */ - #ifdef __cplusplus } #endif diff --git a/include/libxml/parser.h b/include/libxml/parser.h index 212f478a..7a005a4b 100644 --- a/include/libxml/parser.h +++ b/include/libxml/parser.h @@ -888,14 +888,30 @@ XMLPUBFUN xmlDocPtr #endif /* LIBXML_SAX1_ENABLED */ XML_DEPRECATED XMLPUBFUN int xmlSubstituteEntitiesDefault(int val); +XML_DEPRECATED XMLPUBFUN int + xmlThrDefSubstituteEntitiesDefaultValue(int v); XML_DEPRECATED XMLPUBFUN int xmlKeepBlanksDefault (int val); +XML_DEPRECATED XMLPUBFUN int + xmlThrDefKeepBlanksDefaultValue(int v); XMLPUBFUN void xmlStopParser (xmlParserCtxtPtr ctxt); XML_DEPRECATED XMLPUBFUN int xmlPedanticParserDefault(int val); +XML_DEPRECATED XMLPUBFUN int + xmlThrDefPedanticParserDefaultValue(int v); XML_DEPRECATED XMLPUBFUN int xmlLineNumbersDefault (int val); +XML_DEPRECATED XMLPUBFUN int + xmlThrDefLineNumbersDefaultValue(int v); +XML_DEPRECATED XMLPUBFUN int + xmlThrDefDoValidityCheckingDefaultValue(int v); +XML_DEPRECATED XMLPUBFUN int + xmlThrDefGetWarningsDefaultValue(int v); +XML_DEPRECATED XMLPUBFUN int + xmlThrDefLoadExtDtdDefaultValue(int v); +XML_DEPRECATED XMLPUBFUN int + xmlThrDefParserDebugEntities(int v); #ifdef LIBXML_SAX1_ENABLED /* diff --git a/include/libxml/threads.h b/include/libxml/threads.h index 7e08ee4b..8f4b6e17 100644 --- a/include/libxml/threads.h +++ b/include/libxml/threads.h @@ -29,6 +29,9 @@ typedef xmlMutex *xmlMutexPtr; typedef struct _xmlRMutex xmlRMutex; typedef xmlRMutex *xmlRMutexPtr; +XMLPUBFUN int + xmlCheckThreadLocalStorage(void); + XMLPUBFUN xmlMutexPtr xmlNewMutex (void); XMLPUBFUN void @@ -67,6 +70,15 @@ XML_DEPRECATED XMLPUBFUN void xmlCleanupThreads(void); +/** DOC_DISABLE */ +#if defined(LIBXML_THREAD_ENABLED) && defined(_WIN32) && \ + defined(LIBXML_STATIC_FOR_DLL) +int +xmlDllMain(void *hinstDLL, unsigned long fdwReason, + void *lpvReserved); +#endif +/** DOC_ENABLE */ + #ifdef __cplusplus } #endif diff --git a/include/libxml/tree.h b/include/libxml/tree.h index 15a6b962..e1274ece 100644 --- a/include/libxml/tree.h +++ b/include/libxml/tree.h @@ -1331,6 +1331,15 @@ XMLPUBFUN xmlRegisterNodeFunc xmlRegisterNodeDefault (xmlRegisterNodeFunc func); XMLPUBFUN xmlDeregisterNodeFunc xmlDeregisterNodeDefault (xmlDeregisterNodeFunc func); +XMLPUBFUN xmlRegisterNodeFunc + xmlThrDefRegisterNodeDefault(xmlRegisterNodeFunc func); +XMLPUBFUN xmlDeregisterNodeFunc + xmlThrDefDeregisterNodeDefault(xmlDeregisterNodeFunc func); + +XML_DEPRECATED XMLPUBFUN xmlBufferAllocationScheme + xmlThrDefBufferAllocScheme (xmlBufferAllocationScheme v); +XML_DEPRECATED XMLPUBFUN int + xmlThrDefDefaultBufferSize (int v); #ifdef __cplusplus } diff --git a/include/libxml/xmlIO.h b/include/libxml/xmlIO.h index 8e219028..b3b9288d 100644 --- a/include/libxml/xmlIO.h +++ b/include/libxml/xmlIO.h @@ -404,6 +404,12 @@ XMLPUBFUN xmlParserInputBufferCreateFilenameFunc XMLPUBFUN xmlOutputBufferCreateFilenameFunc xmlOutputBufferCreateFilenameDefault( xmlOutputBufferCreateFilenameFunc func); +XMLPUBFUN xmlOutputBufferCreateFilenameFunc + xmlThrDefOutputBufferCreateFilenameDefault( + xmlOutputBufferCreateFilenameFunc func); +XMLPUBFUN xmlParserInputBufferCreateFilenameFunc + xmlThrDefParserInputBufferCreateFilenameDefault( + xmlParserInputBufferCreateFilenameFunc func); #ifdef __cplusplus } diff --git a/include/libxml/xmlerror.h b/include/libxml/xmlerror.h index dd466f42..3f7483c5 100644 --- a/include/libxml/xmlerror.h +++ b/include/libxml/xmlerror.h @@ -884,6 +884,9 @@ XML_GLOBALS_ERROR XMLPUBFUN void xmlSetGenericErrorFunc (void *ctx, xmlGenericErrorFunc handler); +XMLPUBFUN void + xmlThrDefSetGenericErrorFunc(void *ctx, + xmlGenericErrorFunc handler); XML_DEPRECATED XMLPUBFUN void initGenericErrorDefaultFunc (xmlGenericErrorFunc *handler); @@ -891,6 +894,9 @@ XMLPUBFUN void XMLPUBFUN void xmlSetStructuredErrorFunc (void *ctx, xmlStructuredErrorFunc handler); +XMLPUBFUN void + xmlThrDefSetStructuredErrorFunc(void *ctx, + xmlStructuredErrorFunc handler); /* * Default message routines used by SAX and Valid context for error * and warning reporting. diff --git a/include/libxml/xmlsave.h b/include/libxml/xmlsave.h index d91a05e9..5fed632e 100644 --- a/include/libxml/xmlsave.h +++ b/include/libxml/xmlsave.h @@ -94,6 +94,14 @@ XMLPUBFUN int XMLPUBFUN int xmlSaveSetAttrEscape (xmlSaveCtxtPtr ctxt, xmlCharEncodingOutputFunc escape); + +XMLPUBFUN int + xmlThrDefIndentTreeOutput(int v); +XMLPUBFUN const char * + xmlThrDefTreeIndentString(const char * v); +XMLPUBFUN int + xmlThrDefSaveNoEmptyTags(int v); + #ifdef __cplusplus } #endif diff --git a/python/libxml.c b/python/libxml.c index 03a11018..bf048006 100644 --- a/python/libxml.c +++ b/python/libxml.c @@ -26,7 +26,6 @@ #include #include #include -#include #include "libxml_wrap.h" #include "libxml2-py.h" diff --git a/python/libxml_wrap.h b/python/libxml_wrap.h index 0fae2222..96682454 100644 --- a/python/libxml_wrap.h +++ b/python/libxml_wrap.h @@ -19,6 +19,7 @@ #include #include #include +#include #ifdef LIBXML_SCHEMAS_ENABLED #include #include diff --git a/testThreads.c b/testThreads.c index b84d797d..b7bf3277 100644 --- a/testThreads.c +++ b/testThreads.c @@ -5,7 +5,6 @@ #include #include -#include #if defined(LIBXML_THREAD_ENABLED) && defined(LIBXML_CATALOG_ENABLED) #include