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

globals: Move error globals back to xmlerror.c

This commit is contained in:
Nick Wellnhofer
2023-09-20 17:17:49 +02:00
parent d1336fd393
commit eb985d6f8e
4 changed files with 24 additions and 12 deletions

View File

@@ -14,7 +14,6 @@
#include <libxml/parser.h> #include <libxml/parser.h>
#include <libxml/xmlerror.h> #include <libxml/xmlerror.h>
#include <libxml/xmlmemory.h> #include <libxml/xmlmemory.h>
#include <libxml/globals.h>
#include "private/error.h" #include "private/error.h"

View File

@@ -17,6 +17,7 @@
#define XML_GLOBALS_NO_REDEFINITION #define XML_GLOBALS_NO_REDEFINITION
#include <libxml/globals.h> #include <libxml/globals.h>
#include <libxml/xmlerror.h>
#include <libxml/xmlmemory.h> #include <libxml/xmlmemory.h>
#include <libxml/threads.h> #include <libxml/threads.h>
#include <libxml/SAX.h> #include <libxml/SAX.h>
@@ -81,6 +82,7 @@ struct _xmlGlobalState {
#define XML_OP XML_DECLARE_MEMBER #define XML_OP XML_DECLARE_MEMBER
XML_GLOBALS XML_GLOBALS
XML_GLOBALS_ALLOC XML_GLOBALS_ALLOC
XML_GLOBALS_ERROR
#undef XML_OP #undef XML_OP
}; };
@@ -1138,6 +1140,7 @@ xmlThrDefOutputBufferCreateFilenameDefault(xmlOutputBufferCreateFilenameFunc fun
#define XML_OP XML_DEFINE_GLOBAL_WRAPPER #define XML_OP XML_DEFINE_GLOBAL_WRAPPER
XML_GLOBALS XML_GLOBALS
XML_GLOBALS_ALLOC XML_GLOBALS_ALLOC
XML_GLOBALS_ERROR
#undef XML_OP #undef XML_OP
/* For backward compatibility */ /* For backward compatibility */

View File

@@ -86,12 +86,6 @@ xmlDllMain(void *hinstDLL, unsigned long fdwReason,
/* Declare globals with macro magic */ /* Declare globals with macro magic */
#define XML_GLOBALS_CORE \ #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 */ \ /* output options */ \
XML_OP(xmlIndentTreeOutput, int, XML_EMPTY) \ XML_OP(xmlIndentTreeOutput, int, XML_EMPTY) \
XML_OP(xmlTreeIndentString, const char *, XML_EMPTY) \ XML_OP(xmlTreeIndentString, const char *, XML_EMPTY) \
@@ -134,7 +128,6 @@ XML_GLOBALS
#undef XML_OP #undef XML_OP
#if defined(LIBXML_THREAD_ENABLED) && !defined(XML_GLOBALS_NO_REDEFINITION) #if defined(LIBXML_THREAD_ENABLED) && !defined(XML_GLOBALS_NO_REDEFINITION)
#define xmlLastError XML_GLOBAL_MACRO(xmlLastError)
#define oldXMLWDcompatibility XML_GLOBAL_MACRO(oldXMLWDcompatibility) #define oldXMLWDcompatibility XML_GLOBAL_MACRO(oldXMLWDcompatibility)
#define xmlBufferAllocScheme XML_GLOBAL_MACRO(xmlBufferAllocScheme) #define xmlBufferAllocScheme XML_GLOBAL_MACRO(xmlBufferAllocScheme)
#define xmlDefaultBufferSize XML_GLOBAL_MACRO(xmlDefaultBufferSize) #define xmlDefaultBufferSize XML_GLOBAL_MACRO(xmlDefaultBufferSize)
@@ -142,10 +135,6 @@ XML_GLOBALS
#define xmlDefaultSAXLocator XML_GLOBAL_MACRO(xmlDefaultSAXLocator) #define xmlDefaultSAXLocator XML_GLOBAL_MACRO(xmlDefaultSAXLocator)
#define xmlDoValidityCheckingDefaultValue \ #define xmlDoValidityCheckingDefaultValue \
XML_GLOBAL_MACRO(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 \ #define xmlGetWarningsDefaultValue \
XML_GLOBAL_MACRO(xmlGetWarningsDefaultValue) XML_GLOBAL_MACRO(xmlGetWarningsDefaultValue)
#define xmlIndentTreeOutput XML_GLOBAL_MACRO(xmlIndentTreeOutput) #define xmlIndentTreeOutput XML_GLOBAL_MACRO(xmlIndentTreeOutput)

View File

@@ -10,6 +10,8 @@
#ifndef __XML_ERROR_H__ #ifndef __XML_ERROR_H__
#define __XML_ERROR_H__ #define __XML_ERROR_H__
#include <libxml/xmlversion.h>
#ifdef __cplusplus #ifdef __cplusplus
extern "C" { extern "C" {
#endif #endif
@@ -856,6 +858,25 @@ typedef void (*xmlGenericErrorFunc) (void *ctx,
*/ */
typedef void (*xmlStructuredErrorFunc) (void *userData, xmlErrorPtr error); 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 * Use the following function to reset the two global variables
* xmlGenericError and xmlGenericErrorContext. * xmlGenericError and xmlGenericErrorContext.