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

globals: Make xmlGlobalState private

This removes a public struct but it seems impossible to use its members
in a sensible way from external code.
This commit is contained in:
Nick Wellnhofer
2023-09-18 18:44:32 +02:00
parent a07ec7c1a7
commit 89f4976728
2 changed files with 50 additions and 85 deletions

View File

@@ -40,6 +40,56 @@
*/ */
static xmlMutex xmlThrDefMutex; static xmlMutex xmlThrDefMutex;
struct _xmlGlobalState {
const char *gsParserVersion;
xmlSAXLocator gsDefaultSAXLocator;
#ifdef LIBXML_SAX1_ENABLED
xmlSAXHandlerV1 gsDefaultSAXHandler;
#ifdef LIBXML_HTML_ENABLED
xmlSAXHandlerV1 gsHtmlDefaultSAXHandler;
#endif
#endif
xmlFreeFunc gsFree;
xmlMallocFunc gsMalloc;
xmlStrdupFunc gsMemStrdup;
xmlReallocFunc gsRealloc;
xmlGenericErrorFunc gsGenericError;
xmlStructuredErrorFunc gsStructuredError;
void *gsGenericErrorContext;
int gsOldXMLWDcompatibility;
xmlBufferAllocationScheme gsBufferAllocScheme;
int gsDefaultBufferSize;
int gsSubstituteEntitiesDefaultValue;
int gsDoValidityCheckingDefaultValue;
int gsGetWarningsDefaultValue;
int gsKeepBlanksDefaultValue;
int gsLineNumbersDefaultValue;
int gsLoadExtDtdDefaultValue;
int gsParserDebugEntities;
int gsPedanticParserDefaultValue;
int gsSaveNoEmptyTags;
int gsIndentTreeOutput;
const char *gsTreeIndentString;
xmlRegisterNodeFunc gsRegisterNodeDefaultValue;
xmlDeregisterNodeFunc gsDeregisterNodeDefaultValue;
xmlMallocFunc gsMallocAtomic;
xmlError gsLastError;
xmlParserInputBufferCreateFilenameFunc gsParserInputBufferCreateFilenameValue;
xmlOutputBufferCreateFilenameFunc gsOutputBufferCreateFilenameValue;
void *gsStructuredErrorContext;
};
#ifdef LIBXML_THREAD_ENABLED #ifdef LIBXML_THREAD_ENABLED
static void static void
xmlFreeGlobalState(void *state); xmlFreeGlobalState(void *state);

View File

@@ -64,44 +64,6 @@ xmlParserInputBufferCreateFilenameDefault (xmlParserInputBufferCreateFilenameFun
XMLPUBFUN xmlOutputBufferCreateFilenameFunc XMLPUBFUN xmlOutputBufferCreateFilenameFunc
xmlOutputBufferCreateFilenameDefault (xmlOutputBufferCreateFilenameFunc func); xmlOutputBufferCreateFilenameDefault (xmlOutputBufferCreateFilenameFunc func);
/*
* Externally global symbols which need to be protected for backwards
* compatibility support.
*/
#undef htmlDefaultSAXHandler
#undef oldXMLWDcompatibility
#undef xmlBufferAllocScheme
#undef xmlDefaultBufferSize
#undef xmlDefaultSAXHandler
#undef xmlDefaultSAXLocator
#undef xmlDoValidityCheckingDefaultValue
#undef xmlFree
#undef xmlGenericError
#undef xmlStructuredError
#undef xmlGenericErrorContext
#undef xmlStructuredErrorContext
#undef xmlGetWarningsDefaultValue
#undef xmlIndentTreeOutput
#undef xmlTreeIndentString
#undef xmlKeepBlanksDefaultValue
#undef xmlLineNumbersDefaultValue
#undef xmlLoadExtDtdDefaultValue
#undef xmlMalloc
#undef xmlMallocAtomic
#undef xmlMemStrdup
#undef xmlParserDebugEntities
#undef xmlParserVersion
#undef xmlPedanticParserDefaultValue
#undef xmlRealloc
#undef xmlSaveNoEmptyTags
#undef xmlSubstituteEntitiesDefaultValue
#undef xmlRegisterNodeDefaultValue
#undef xmlDeregisterNodeDefaultValue
#undef xmlLastError
#undef xmlParserInputBufferCreateFilenameValue
#undef xmlOutputBufferCreateFilenameValue
/** /**
* xmlRegisterNodeFunc: * xmlRegisterNodeFunc:
* @node: the current node * @node: the current node
@@ -119,53 +81,6 @@ typedef void (*xmlDeregisterNodeFunc) (xmlNodePtr node);
typedef struct _xmlGlobalState xmlGlobalState; typedef struct _xmlGlobalState xmlGlobalState;
typedef xmlGlobalState *xmlGlobalStatePtr; typedef xmlGlobalState *xmlGlobalStatePtr;
struct _xmlGlobalState
{
const char *gsParserVersion;
xmlSAXLocator gsDefaultSAXLocator;
xmlSAXHandlerV1 gsDefaultSAXHandler;
xmlSAXHandlerV1 gsDocbDefaultSAXHandler; /* unused */
xmlSAXHandlerV1 gsHtmlDefaultSAXHandler;
xmlFreeFunc gsFree;
xmlMallocFunc gsMalloc;
xmlStrdupFunc gsMemStrdup;
xmlReallocFunc gsRealloc;
xmlGenericErrorFunc gsGenericError;
xmlStructuredErrorFunc gsStructuredError;
void *gsGenericErrorContext;
int gsOldXMLWDcompatibility;
xmlBufferAllocationScheme gsBufferAllocScheme;
int gsDefaultBufferSize;
int gsSubstituteEntitiesDefaultValue;
int gsDoValidityCheckingDefaultValue;
int gsGetWarningsDefaultValue;
int gsKeepBlanksDefaultValue;
int gsLineNumbersDefaultValue;
int gsLoadExtDtdDefaultValue;
int gsParserDebugEntities;
int gsPedanticParserDefaultValue;
int gsSaveNoEmptyTags;
int gsIndentTreeOutput;
const char *gsTreeIndentString;
xmlRegisterNodeFunc gsRegisterNodeDefaultValue;
xmlDeregisterNodeFunc gsDeregisterNodeDefaultValue;
xmlMallocFunc gsMallocAtomic;
xmlError gsLastError;
xmlParserInputBufferCreateFilenameFunc gsParserInputBufferCreateFilenameValue;
xmlOutputBufferCreateFilenameFunc gsOutputBufferCreateFilenameValue;
void *gsStructuredErrorContext;
};
XML_DEPRECATED XML_DEPRECATED
XMLPUBFUN void xmlInitializeGlobalState(xmlGlobalStatePtr gs); XMLPUBFUN void xmlInitializeGlobalState(xmlGlobalStatePtr gs);