diff --git a/error.c b/error.c index 4de1418e..d9a0f4c8 100644 --- a/error.c +++ b/error.c @@ -14,7 +14,6 @@ #include #include #include -#include #include "private/error.h" diff --git a/globals.c b/globals.c index eb022846..8e9fec51 100644 --- a/globals.c +++ b/globals.c @@ -17,6 +17,7 @@ #define XML_GLOBALS_NO_REDEFINITION #include +#include #include #include #include @@ -81,6 +82,7 @@ struct _xmlGlobalState { #define XML_OP XML_DECLARE_MEMBER XML_GLOBALS XML_GLOBALS_ALLOC +XML_GLOBALS_ERROR #undef XML_OP }; @@ -1138,6 +1140,7 @@ xmlThrDefOutputBufferCreateFilenameDefault(xmlOutputBufferCreateFilenameFunc fun #define XML_OP XML_DEFINE_GLOBAL_WRAPPER XML_GLOBALS XML_GLOBALS_ALLOC + XML_GLOBALS_ERROR #undef XML_OP /* For backward compatibility */ diff --git a/include/libxml/globals.h b/include/libxml/globals.h index effac64f..c6f7dc9a 100644 --- a/include/libxml/globals.h +++ b/include/libxml/globals.h @@ -86,12 +86,6 @@ xmlDllMain(void *hinstDLL, unsigned long fdwReason, /* Declare globals with macro magic */ #define XML_GLOBALS_CORE \ - /* error handling */ \ - XML_OP(xmlLastError, xmlError, XML_DEPRECATED) \ - XML_OP(xmlGenericError, xmlGenericErrorFunc, XML_EMPTY) \ - XML_OP(xmlGenericErrorContext, void *, XML_EMPTY) \ - XML_OP(xmlStructuredError, xmlStructuredErrorFunc, XML_EMPTY) \ - XML_OP(xmlStructuredErrorContext, void *, XML_EMPTY) \ /* output options */ \ XML_OP(xmlIndentTreeOutput, int, XML_EMPTY) \ XML_OP(xmlTreeIndentString, const char *, XML_EMPTY) \ @@ -134,7 +128,6 @@ XML_GLOBALS #undef XML_OP #if defined(LIBXML_THREAD_ENABLED) && !defined(XML_GLOBALS_NO_REDEFINITION) - #define xmlLastError XML_GLOBAL_MACRO(xmlLastError) #define oldXMLWDcompatibility XML_GLOBAL_MACRO(oldXMLWDcompatibility) #define xmlBufferAllocScheme XML_GLOBAL_MACRO(xmlBufferAllocScheme) #define xmlDefaultBufferSize XML_GLOBAL_MACRO(xmlDefaultBufferSize) @@ -142,10 +135,6 @@ XML_GLOBALS #define xmlDefaultSAXLocator XML_GLOBAL_MACRO(xmlDefaultSAXLocator) #define xmlDoValidityCheckingDefaultValue \ XML_GLOBAL_MACRO(xmlDoValidityCheckingDefaultValue) - #define xmlGenericError XML_GLOBAL_MACRO(xmlGenericError) - #define xmlStructuredError XML_GLOBAL_MACRO(xmlStructuredError) - #define xmlGenericErrorContext XML_GLOBAL_MACRO(xmlGenericErrorContext) - #define xmlStructuredErrorContext XML_GLOBAL_MACRO(xmlStructuredErrorContext) #define xmlGetWarningsDefaultValue \ XML_GLOBAL_MACRO(xmlGetWarningsDefaultValue) #define xmlIndentTreeOutput XML_GLOBAL_MACRO(xmlIndentTreeOutput) diff --git a/include/libxml/xmlerror.h b/include/libxml/xmlerror.h index 42cd4ba7..dd466f42 100644 --- a/include/libxml/xmlerror.h +++ b/include/libxml/xmlerror.h @@ -10,6 +10,8 @@ #ifndef __XML_ERROR_H__ #define __XML_ERROR_H__ +#include + #ifdef __cplusplus extern "C" { #endif @@ -856,6 +858,25 @@ typedef void (*xmlGenericErrorFunc) (void *ctx, */ typedef void (*xmlStructuredErrorFunc) (void *userData, xmlErrorPtr error); +#define XML_GLOBALS_ERROR \ + XML_OP(xmlLastError, xmlError, XML_DEPRECATED) \ + XML_OP(xmlGenericError, xmlGenericErrorFunc, XML_EMPTY) \ + XML_OP(xmlGenericErrorContext, void *, XML_EMPTY) \ + XML_OP(xmlStructuredError, xmlStructuredErrorFunc, XML_EMPTY) \ + XML_OP(xmlStructuredErrorContext, void *, XML_EMPTY) + +#define XML_OP XML_DECLARE_GLOBAL +XML_GLOBALS_ERROR +#undef XML_OP + +#if defined(LIBXML_THREAD_ENABLED) && !defined(XML_GLOBALS_NO_REDEFINITION) + #define xmlLastError XML_GLOBAL_MACRO(xmlLastError) + #define xmlGenericError XML_GLOBAL_MACRO(xmlGenericError) + #define xmlGenericErrorContext XML_GLOBAL_MACRO(xmlGenericErrorContext) + #define xmlStructuredError XML_GLOBAL_MACRO(xmlStructuredError) + #define xmlStructuredErrorContext XML_GLOBAL_MACRO(xmlStructuredErrorContext) +#endif + /* * Use the following function to reset the two global variables * xmlGenericError and xmlGenericErrorContext.