aboutsummaryrefslogtreecommitdiffstats
path: root/globals.c
diff options
context:
space:
mode:
authorDaniel Veillard <veillard@src.gnome.org>2001-10-17 15:58:35 +0000
committerDaniel Veillard <veillard@src.gnome.org>2001-10-17 15:58:35 +0000
commit3c01b1d81b696fe8624b6d7e26ec0ebffcc7c06b (patch)
treec6c072df9035dc652fb2f20c87aef0cfdcb3af74 /globals.c
parent7cc95c0b6afdd34cd570c461e71cf696ea19271d (diff)
downloadandroid_external_libxml2-3c01b1d81b696fe8624b6d7e26ec0ebffcc7c06b.tar.gz
android_external_libxml2-3c01b1d81b696fe8624b6d7e26ec0ebffcc7c06b.tar.bz2
android_external_libxml2-3c01b1d81b696fe8624b6d7e26ec0ebffcc7c06b.zip
- include/libxml/globals.h include/libxml/threads.h threads.c
testThreads.c: far more testing, cleaning up bugs - *.c : make sure globals.h is always included. Daniel
Diffstat (limited to 'globals.c')
-rw-r--r--globals.c27
1 files changed, 16 insertions, 11 deletions
diff --git a/globals.c b/globals.c
index 69a84f28..cfa5ca66 100644
--- a/globals.c
+++ b/globals.c
@@ -18,19 +18,17 @@
#endif
#include <string.h>
+#include <libxml/xmlversion.h>
+#include <libxml/globals.h>
#include <libxml/xmlmemory.h>
+/* #define DEBUG_GLOBALS */
+
/*
* Helpful Macro
*/
-#ifdef WITH_PTHREAD_H
-#if defined(SOLARIS)
-#define THR_MAIN(tid) (-1 == thr_main() || tid == thr_main())
-#else
-#define THR_MAIN(tid) (tid == 0 || tid == 1024)
-#endif
-
-#define IS_MAIN_THREAD (THR_MAIN(pthread_self()))
+#ifdef LIBXML_THREAD_ENABLED
+#define IS_MAIN_THREAD (xmlIsMainThread())
#else
#define IS_MAIN_THREAD 1
#endif
@@ -41,8 +39,6 @@
* *
************************************************************************/
-const char *xmlParserVersion = LIBXML_VERSION_STRING;
-
/*
* Memory allocation routines
*/
@@ -93,6 +89,8 @@ xmlStrdupFunc xmlMemStrdup = (xmlStrdupFunc) strdup;
#undef xmlMemStrdup
#undef xmlRealloc
+const char *xmlParserVersion = LIBXML_VERSION_STRING;
+
/*
* Buffers stuff
*/
@@ -252,11 +250,19 @@ xmlSAXHandler docbDefaultSAXHandler = {
void
xmlInitializeGlobalState(xmlGlobalStatePtr gs)
{
+#ifdef DEBUG_GLOBALS
+ fprintf(stderr, "Initializing globals at %lu for thread %d\n",
+ (unsigned long) gs, xmlGetThreadId());
+#endif
+
/*
* Perform initialisation as required by libxml
*/
+ initxmlDefaultSAXHandler(&gs->xmlDefaultSAXHandler, 1);
initdocbDefaultSAXHandler(&gs->docbDefaultSAXHandler);
inithtmlDefaultSAXHandler(&gs->htmlDefaultSAXHandler);
+ initGenericErrorDefaultFunc(&gs->xmlGenericError);
+
gs->oldXMLWDcompatibility = 0;
gs->xmlBufferAllocScheme = XML_BUFFER_ALLOC_EXACT;
gs->xmlDefaultBufferSize = BASE_BUFFER_SIZE;
@@ -277,7 +283,6 @@ xmlInitializeGlobalState(xmlGlobalStatePtr gs)
gs->xmlRealloc = (xmlReallocFunc) realloc;
gs->xmlMemStrdup = (xmlStrdupFunc) strdup;
#endif
- initGenericErrorDefaultFunc(&gs->xmlGenericError);
gs->xmlGenericErrorContext = NULL;
gs->xmlGetWarningsDefaultValue = 1;
gs->xmlIndentTreeOutput = 0;