summaryrefslogtreecommitdiff
path: root/gnulib-local/lib/libxml/globals.c
diff options
context:
space:
mode:
Diffstat (limited to 'gnulib-local/lib/libxml/globals.c')
-rw-r--r--gnulib-local/lib/libxml/globals.c54
1 files changed, 37 insertions, 17 deletions
diff --git a/gnulib-local/lib/libxml/globals.c b/gnulib-local/lib/libxml/globals.c
index c104a1a..e351b03 100644
--- a/gnulib-local/lib/libxml/globals.c
+++ b/gnulib-local/lib/libxml/globals.c
@@ -46,7 +46,8 @@ static xmlMutexPtr xmlThrDefMutex = NULL;
*/
void xmlInitGlobals(void)
{
- xmlThrDefMutex = xmlNewMutex();
+ if (xmlThrDefMutex == NULL)
+ xmlThrDefMutex = xmlNewMutex();
}
/**
@@ -60,12 +61,13 @@ void xmlCleanupGlobals(void)
xmlFreeMutex(xmlThrDefMutex);
xmlThrDefMutex = NULL;
}
+ __xmlGlobalInitMutexDestroy();
}
/************************************************************************
- * *
+ * *
* All the user accessible global variables of the library *
- * *
+ * *
************************************************************************/
/*
@@ -147,6 +149,7 @@ xmlStrdupFunc xmlMemStrdup = (xmlStrdupFunc) xmlStrdup;
#undef xmlGenericError
#undef xmlStructuredError
#undef xmlGenericErrorContext
+#undef xmlStructuredErrorContext
#undef xmlGetWarningsDefaultValue
#undef xmlIndentTreeOutput
#undef xmlTreeIndentString
@@ -243,7 +246,7 @@ static int xmlPedanticParserDefaultValueThrDef = 0;
* xmlLineNumbersDefaultValue:
*
* Global setting, indicate that the parser should store the line number
- * in the content field of elements in the DOM tree.
+ * in the content field of elements in the DOM tree.
* Disabled by default since this may not be safe for old classes of
* applicaton.
*/
@@ -313,6 +316,13 @@ static xmlStructuredErrorFunc xmlStructuredErrorThrDef = NULL;
*/
void *xmlGenericErrorContext = NULL;
static void *xmlGenericErrorContextThrDef = NULL;
+/**
+ * xmlStructuredErrorContext:
+ *
+ * Global setting passed to structured error callbacks
+ */
+void *xmlStructuredErrorContext = NULL;
+static void *xmlStructuredErrorContextThrDef = NULL;
xmlError xmlLastError;
/*
@@ -499,7 +509,7 @@ xmlInitializeGlobalState(xmlGlobalStatePtr gs)
#if defined(LIBXML_DOCB_ENABLED) && defined(LIBXML_LEGACY_ENABLED) && defined(LIBXML_SAX1_ENABLED)
initdocbDefaultSAXHandler(&gs->docbDefaultSAXHandler);
#endif
-#if defined(LIBXML_HTML_ENABLED) && defined(LIBXML_LEGACY_ENABLED)
+#if defined(LIBXML_HTML_ENABLED) && defined(LIBXML_LEGACY_ENABLED) && defined(LIBXML_SAX1_ENABLED)
inithtmlDefaultSAXHandler(&gs->htmlDefaultSAXHandler);
#endif
@@ -513,7 +523,7 @@ xmlInitializeGlobalState(xmlGlobalStatePtr gs)
gs->xmlDefaultSAXLocator.getSystemId = xmlSAX2GetSystemId;
gs->xmlDefaultSAXLocator.getLineNumber = xmlSAX2GetLineNumber;
gs->xmlDefaultSAXLocator.getColumnNumber = xmlSAX2GetColumnNumber;
- gs->xmlDoValidityCheckingDefaultValue =
+ gs->xmlDoValidityCheckingDefaultValue =
xmlDoValidityCheckingDefaultValueThrDef;
#if defined(DEBUG_MEMORY_LOCATION) | defined(DEBUG_MEMORY)
gs->xmlFree = (xmlFreeFunc) xmlMemFree;
@@ -538,12 +548,13 @@ xmlInitializeGlobalState(xmlGlobalStatePtr gs)
gs->xmlParserVersion = LIBXML_VERSION_STRING;
gs->xmlPedanticParserDefaultValue = xmlPedanticParserDefaultValueThrDef;
gs->xmlSaveNoEmptyTags = xmlSaveNoEmptyTagsThrDef;
- gs->xmlSubstituteEntitiesDefaultValue =
+ gs->xmlSubstituteEntitiesDefaultValue =
xmlSubstituteEntitiesDefaultValueThrDef;
gs->xmlGenericError = xmlGenericErrorThrDef;
gs->xmlStructuredError = xmlStructuredErrorThrDef;
gs->xmlGenericErrorContext = xmlGenericErrorContextThrDef;
+ gs->xmlStructuredErrorContext = xmlStructuredErrorContextThrDef;
gs->xmlRegisterNodeDefaultValue = xmlRegisterNodeDefaultValueThrDef;
gs->xmlDeregisterNodeDefaultValue = xmlDeregisterNodeDefaultValueThrDef;
@@ -572,7 +583,7 @@ xmlThrDefSetGenericErrorFunc(void *ctx, xmlGenericErrorFunc handler) {
void
xmlThrDefSetStructuredErrorFunc(void *ctx, xmlStructuredErrorFunc handler) {
xmlMutexLock(xmlThrDefMutex);
- xmlGenericErrorContextThrDef = ctx;
+ xmlStructuredErrorContextThrDef = ctx;
xmlStructuredErrorThrDef = handler;
xmlMutexUnlock(xmlThrDefMutex);
}
@@ -589,7 +600,7 @@ xmlRegisterNodeFunc
xmlRegisterNodeDefault(xmlRegisterNodeFunc func)
{
xmlRegisterNodeFunc old = xmlRegisterNodeDefaultValue;
-
+
__xmlRegisterCallbacks = 1;
xmlRegisterNodeDefaultValue = func;
return(old);
@@ -599,10 +610,10 @@ xmlRegisterNodeFunc
xmlThrDefRegisterNodeDefault(xmlRegisterNodeFunc func)
{
xmlRegisterNodeFunc old;
-
+
xmlMutexLock(xmlThrDefMutex);
old = xmlRegisterNodeDefaultValueThrDef;
-
+
__xmlRegisterCallbacks = 1;
xmlRegisterNodeDefaultValueThrDef = func;
xmlMutexUnlock(xmlThrDefMutex);
@@ -622,7 +633,7 @@ xmlDeregisterNodeFunc
xmlDeregisterNodeDefault(xmlDeregisterNodeFunc func)
{
xmlDeregisterNodeFunc old = xmlDeregisterNodeDefaultValue;
-
+
__xmlRegisterCallbacks = 1;
xmlDeregisterNodeDefaultValue = func;
return(old);
@@ -635,7 +646,7 @@ xmlThrDefDeregisterNodeDefault(xmlDeregisterNodeFunc func)
xmlMutexLock(xmlThrDefMutex);
old = xmlDeregisterNodeDefaultValueThrDef;
-
+
__xmlRegisterCallbacks = 1;
xmlDeregisterNodeDefaultValueThrDef = func;
xmlMutexUnlock(xmlThrDefMutex);
@@ -647,7 +658,7 @@ xmlParserInputBufferCreateFilenameFunc
xmlThrDefParserInputBufferCreateFilenameDefault(xmlParserInputBufferCreateFilenameFunc func)
{
xmlParserInputBufferCreateFilenameFunc old;
-
+
xmlMutexLock(xmlThrDefMutex);
old = xmlParserInputBufferCreateFilenameValueThrDef;
if (old == NULL) {
@@ -664,7 +675,7 @@ xmlOutputBufferCreateFilenameFunc
xmlThrDefOutputBufferCreateFilenameDefault(xmlOutputBufferCreateFilenameFunc func)
{
xmlOutputBufferCreateFilenameFunc old;
-
+
xmlMutexLock(xmlThrDefMutex);
old = xmlOutputBufferCreateFilenameValueThrDef;
#ifdef LIBXML_OUTPUT_ENABLED
@@ -721,7 +732,7 @@ __xmlMalloc(void){
if (IS_MAIN_THREAD)
return (&xmlMalloc);
else
- return (&xmlGetGlobalState()->xmlMalloc);
+ return (&xmlGetGlobalState()->xmlMalloc);
}
#undef xmlMallocAtomic
@@ -875,6 +886,15 @@ __xmlGenericErrorContext(void) {
return (&xmlGetGlobalState()->xmlGenericErrorContext);
}
+#undef xmlStructuredErrorContext
+void * *
+__xmlStructuredErrorContext(void) {
+ if (IS_MAIN_THREAD)
+ return (&xmlStructuredErrorContext);
+ else
+ return (&xmlGetGlobalState()->xmlStructuredErrorContext);
+}
+
#undef xmlGetWarningsDefaultValue
int *
__xmlGetWarningsDefaultValue(void) {
@@ -909,7 +929,7 @@ int xmlThrDefIndentTreeOutput(int v) {
return ret;
}
-#undef xmlTreeIndentString
+#undef xmlTreeIndentString
const char * *
__xmlTreeIndentString(void) {
if (IS_MAIN_THREAD)