1
0
mirror of https://gitlab.gnome.org/GNOME/libxml2.git synced 2025-03-28 22:50:07 +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/xmlerror.h>
#include <libxml/xmlmemory.h>
#include <libxml/globals.h>
#include "private/error.h"

View File

@ -17,6 +17,7 @@
#define XML_GLOBALS_NO_REDEFINITION
#include <libxml/globals.h>
#include <libxml/xmlerror.h>
#include <libxml/xmlmemory.h>
#include <libxml/threads.h>
#include <libxml/SAX.h>
@ -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 */

View File

@ -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)

View File

@ -10,6 +10,8 @@
#ifndef __XML_ERROR_H__
#define __XML_ERROR_H__
#include <libxml/xmlversion.h>
#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.