diff options
author | Mike Hommey <glandium@debian.org> | 2009-09-10 22:10:39 +0200 |
---|---|---|
committer | Mike Hommey <glandium@debian.org> | 2009-09-10 22:10:39 +0200 |
commit | c3e4f3c26035bc93a69e5aa2ad435809e8be8a4e (patch) | |
tree | e65557c2e042fe8a77635b0548db10ad97bc1bfe /globals.c | |
parent | e248b20a3b7df364cc9617b8685b4c190338bcd2 (diff) | |
download | libxml2-c3e4f3c26035bc93a69e5aa2ad435809e8be8a4e.tar.gz |
Import upstream version 2.7.4upstream/2.7.4.dfsg
Diffstat (limited to 'globals.c')
-rw-r--r-- | globals.c | 25 |
1 files changed, 22 insertions, 3 deletions
@@ -46,7 +46,8 @@ static xmlMutexPtr xmlThrDefMutex = NULL; */ void xmlInitGlobals(void) { - xmlThrDefMutex = xmlNewMutex(); + if (xmlThrDefMutex != NULL) + xmlThrDefMutex = xmlNewMutex(); } /** @@ -148,6 +149,7 @@ xmlStrdupFunc xmlMemStrdup = (xmlStrdupFunc) xmlStrdup; #undef xmlGenericError #undef xmlStructuredError #undef xmlGenericErrorContext +#undef xmlStructuredErrorContext #undef xmlGetWarningsDefaultValue #undef xmlIndentTreeOutput #undef xmlTreeIndentString @@ -314,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; /* @@ -545,6 +554,7 @@ xmlInitializeGlobalState(xmlGlobalStatePtr gs) gs->xmlGenericError = xmlGenericErrorThrDef; gs->xmlStructuredError = xmlStructuredErrorThrDef; gs->xmlGenericErrorContext = xmlGenericErrorContextThrDef; + gs->xmlStructuredErrorContext = xmlStructuredErrorContextThrDef; gs->xmlRegisterNodeDefaultValue = xmlRegisterNodeDefaultValueThrDef; gs->xmlDeregisterNodeDefaultValue = xmlDeregisterNodeDefaultValueThrDef; @@ -573,7 +583,7 @@ xmlThrDefSetGenericErrorFunc(void *ctx, xmlGenericErrorFunc handler) { void xmlThrDefSetStructuredErrorFunc(void *ctx, xmlStructuredErrorFunc handler) { xmlMutexLock(xmlThrDefMutex); - xmlGenericErrorContextThrDef = ctx; + xmlStructuredErrorContextThrDef = ctx; xmlStructuredErrorThrDef = handler; xmlMutexUnlock(xmlThrDefMutex); } @@ -876,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) { @@ -910,7 +929,7 @@ int xmlThrDefIndentTreeOutput(int v) { return ret; } -#undef xmlTreeIndentString +#undef xmlTreeIndentString const char * * __xmlTreeIndentString(void) { if (IS_MAIN_THREAD) |