summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorWilliam M. Brack <wbrack@src.gnome.org>2002-11-22 05:07:29 +0000
committerWilliam M. Brack <wbrack@src.gnome.org>2002-11-22 05:07:29 +0000
commit8b2c7f10f16dbf1366c7beb89e8c5ab1c4062a1f (patch)
tree246a88807c50360de14de3d3fde803740f5b4121
parentd5c2f92df449ae53e31a81f268aa8aa608a4f633 (diff)
downloadlibxml2-8b2c7f10f16dbf1366c7beb89e8c5ab1c4062a1f.tar.gz
fixed thread problem
-rw-r--r--ChangeLog8
-rw-r--r--globals.c2
-rw-r--r--parserInternals.c14
-rw-r--r--threads.c2
4 files changed, 14 insertions, 12 deletions
diff --git a/ChangeLog b/ChangeLog
index 6a0b1bf8..41613d09 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,11 @@
+Fri Nov 22 13:13:00 HKT 2002 William Brack <wbrack@mmm.com.hk>
+
+ * threads.c: fixed initialization problem in xmlNewGlobalState
+ which was causing crash.
+ * globals.c: removed duplicate call to initxmlDefaultSAXHandler
+ in xmlInitializeGlobalState.
+ * parserInternals.c: cleaned up ctxt->sax initialisation.
+
Thu Nov 21 15:05:45 CET 2002 Daniel Veillard <daniel@veillard.com>
* tree.c include/libxml/tree.h: modified the existing APIs
diff --git a/globals.c b/globals.c
index 2f721c10..72865c32 100644
--- a/globals.c
+++ b/globals.c
@@ -409,7 +409,7 @@ xmlInitializeGlobalState(xmlGlobalStatePtr gs)
/*
* Perform initialization as required by libxml
*/
- initxmlDefaultSAXHandler(&gs->xmlDefaultSAXHandler, 1);
+
#ifdef LIBXML_DOCB_ENABLED
initdocbDefaultSAXHandler(&gs->docbDefaultSAXHandler);
#endif
diff --git a/parserInternals.c b/parserInternals.c
index b526e0a1..c9ea6ed8 100644
--- a/parserInternals.c
+++ b/parserInternals.c
@@ -2146,8 +2146,6 @@ xmlNewInputFromFile(xmlParserCtxtPtr ctxt, const char *filename) {
void
xmlInitParserCtxt(xmlParserCtxtPtr ctxt)
{
- xmlSAXHandler *sax;
-
if(ctxt==NULL) {
xmlGenericError(xmlGenericErrorContext,
"xmlInitParserCtxt: NULL context given\n");
@@ -2156,13 +2154,13 @@ xmlInitParserCtxt(xmlParserCtxtPtr ctxt)
xmlDefaultSAXHandlerInit();
- sax = (xmlSAXHandler *) xmlMalloc(sizeof(xmlSAXHandler));
- if (sax == NULL) {
+ ctxt->sax = (xmlSAXHandler *) xmlMalloc(sizeof(xmlSAXHandler));
+ if (ctxt->sax == NULL) {
xmlGenericError(xmlGenericErrorContext,
"xmlInitParserCtxt: out of memory\n");
}
else
- memset(sax, 0, sizeof(xmlSAXHandler));
+ memcpy(ctxt->sax, &xmlDefaultSAXHandler, sizeof(xmlSAXHandler));
/* Allocate the Input stack */
ctxt->inputTab = (xmlParserInputPtr *)
@@ -2250,10 +2248,6 @@ xmlInitParserCtxt(xmlParserCtxtPtr ctxt)
ctxt->spaceMax = 10;
ctxt->spaceTab[0] = -1;
ctxt->space = &ctxt->spaceTab[0];
-
- ctxt->sax = sax;
- memcpy(sax, &xmlDefaultSAXHandler, sizeof(xmlSAXHandler));
-
ctxt->userData = ctxt;
ctxt->myDoc = NULL;
ctxt->wellFormed = 1;
@@ -2264,7 +2258,7 @@ xmlInitParserCtxt(xmlParserCtxtPtr ctxt)
ctxt->linenumbers = xmlLineNumbersDefaultValue;
ctxt->keepBlanks = xmlKeepBlanksDefaultValue;
if (ctxt->keepBlanks == 0)
- sax->ignorableWhitespace = ignorableWhitespace;
+ ctxt->sax->ignorableWhitespace = ignorableWhitespace;
ctxt->vctxt.userData = ctxt;
ctxt->vctxt.error = xmlParserValidityError;
diff --git a/threads.c b/threads.c
index 505133ea..bd99efda 100644
--- a/threads.c
+++ b/threads.c
@@ -315,7 +315,7 @@ xmlNewGlobalState(void)
if (gs == NULL)
return(NULL);
- memset(gs, 0, sizeof(gs));
+ memset(gs, 0, sizeof(xmlGlobalState));
xmlInitializeGlobalState(gs);
return (gs);
}