[libxml2: 1/3] A bit of cleanups
- From: Daniel Veillard <veillard src gnome org>
- To: svn-commits-list gnome org
- Subject: [libxml2: 1/3] A bit of cleanups
- Date: Thu, 9 Jul 2009 07:04:00 +0000 (UTC)
commit ab2a763db86f4862699cdf36764a4f2bd0a2bc69
Author: Daniel Veillard <veillard redhat com>
Date: Thu Jul 9 08:45:03 2009 +0200
A bit of cleanups
* tree.c: avoid calling xmlAddID with NULL values
* parser.c: add a few xmlInitParser in some entry points
ChangeLog | 7 ++++++-
parser.c | 12 ++++++++----
tree.c | 3 ++-
3 files changed, 16 insertions(+), 6 deletions(-)
---
diff --git a/ChangeLog b/ChangeLog
index 014ea77..31aa926 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,8 +1,13 @@
+Thu Jul 9 08:43:06 CEST 2009 Daniel Veillard <daniel veillard com>
+
+ * tree.c: avoid calling xmlAddID with NULL values
+ * parser.c: add a few xmlInitParser in some entry points
+
Thu Jun 4 11:17:23 CEST 2009 Daniel Veillard <daniel veillard com>
* c14n.c debugXML.c doc/examples/io2.c parser.c schematron.c
valid.c xmlschemas.c xmlwriter.c xpath.c: use %s to printf string
- patch by Christian Persch
+ patch by Christian Persch, fixes #581612
Thu Jun 4 11:06:07 CEST 2009 Daniel Veillard <daniel veillard com>
diff --git a/parser.c b/parser.c
index bcaec7f..6659f2c 100644
--- a/parser.c
+++ b/parser.c
@@ -13568,6 +13568,8 @@ xmlSAXParseMemoryWithData(xmlSAXHandlerPtr sax, const char *buffer,
xmlDocPtr ret;
xmlParserCtxtPtr ctxt;
+ xmlInitParser();
+
ctxt = xmlCreateMemoryParserCtxt(buffer, size);
if (ctxt == NULL) return(NULL);
if (sax != NULL) {
@@ -13593,7 +13595,7 @@ xmlSAXParseMemoryWithData(xmlSAXHandlerPtr sax, const char *buffer,
if (sax != NULL)
ctxt->sax = NULL;
xmlFreeParserCtxt(ctxt);
-
+
return(ret);
}
@@ -13656,14 +13658,16 @@ xmlDocPtr xmlRecoverMemory(const char *buffer, int size) {
*
* A better SAX parsing routine.
* parse an XML in-memory buffer and call the given SAX handler routines.
- *
+ *
* Returns 0 in case of success or a error number otherwise
*/
int xmlSAXUserParseMemory(xmlSAXHandlerPtr sax, void *user_data,
const char *buffer, int size) {
int ret = 0;
xmlParserCtxtPtr ctxt;
-
+
+ xmlInitParser();
+
ctxt = xmlCreateMemoryParserCtxt(buffer, size);
if (ctxt == NULL) return -1;
if (ctxt->sax != (xmlSAXHandlerPtr) &xmlDefaultSAXHandler)
@@ -13673,7 +13677,7 @@ int xmlSAXUserParseMemory(xmlSAXHandlerPtr sax, void *user_data,
if (user_data != NULL)
ctxt->userData = user_data;
-
+
xmlParseDocument(ctxt);
if (ctxt->wellFormed)
diff --git a/tree.c b/tree.c
index be5c6b9..6d0e95b 100644
--- a/tree.c
+++ b/tree.c
@@ -1860,7 +1860,8 @@ xmlNewPropInternal(xmlNodePtr node, xmlNsPtr ns,
}
}
- if (xmlIsID((node == NULL) ? NULL : node->doc, node, cur) == 1)
+ if ((value != NULL) &&
+ (xmlIsID((node == NULL) ? NULL : node->doc, node, cur) == 1))
xmlAddID(NULL, node->doc, value, cur);
if ((__xmlRegisterCallbacks) && (xmlRegisterNodeDefaultValue))
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]