aboutsummaryrefslogtreecommitdiffstats
path: root/globals.c
diff options
context:
space:
mode:
Diffstat (limited to 'globals.c')
-rw-r--r--globals.c14
1 files changed, 13 insertions, 1 deletions
diff --git a/globals.c b/globals.c
index 140bc899..fd61cf41 100644
--- a/globals.c
+++ b/globals.c
@@ -121,7 +121,7 @@ xmlReallocFunc xmlRealloc = (xmlReallocFunc) realloc;
* Returns the copy of the string or NULL in case of error
*/
xmlStrdupFunc xmlMemStrdup = (xmlStrdupFunc) xmlStrdup;
-#endif
+#endif /* DEBUG_MEMORY_LOCATION || DEBUG_MEMORY */
#include <libxml/threads.h>
#include <libxml/globals.h>
@@ -150,6 +150,7 @@ xmlStrdupFunc xmlMemStrdup = (xmlStrdupFunc) xmlStrdup;
#undef xmlSubstituteEntitiesDefaultValue
#undef xmlRegisterNodeDefaultValue
#undef xmlDeregisterNodeDefaultValue
+#undef xmlLastError
#undef xmlFree
#undef xmlMalloc
@@ -293,6 +294,7 @@ static xmlGenericErrorFunc xmlGenericErrorThrDef = xmlGenericErrorDefaultFunc;
*/
void *xmlGenericErrorContext = NULL;
static void *xmlGenericErrorContextThrDef = NULL;
+xmlError xmlLastError;
/*
* output defaults
@@ -524,6 +526,7 @@ xmlInitializeGlobalState(xmlGlobalStatePtr gs)
gs->xmlGenericErrorContext = xmlGenericErrorContextThrDef;
gs->xmlRegisterNodeDefaultValue = xmlRegisterNodeDefaultValueThrDef;
gs->xmlDeregisterNodeDefaultValue = xmlDeregisterNodeDefaultValueThrDef;
+ memset(&gs->xmlLastError, 0, sizeof(xmlError));
xmlMutexUnlock(xmlThrDefMutex);
}
@@ -628,6 +631,15 @@ __htmlDefaultSAXHandler(void) {
}
#endif
+#undef xmlLastError
+xmlError *
+__xmlLastError(void) {
+ if (IS_MAIN_THREAD)
+ return (&xmlLastError);
+ else
+ return (&xmlGetGlobalState()->xmlLastError);
+}
+
/*
* Everything starting from the line below is
* Automatically generated by build_glob.py.