libxml2 r3806 - trunk
- From: rrichard svn gnome org
- To: svn-commits-list gnome org
- Subject: libxml2 r3806 - trunk
- Date: Wed, 31 Dec 2008 22:13:57 +0000 (UTC)
Author: rrichard
Date: Wed Dec 31 22:13:57 2008
New Revision: 3806
URL: http://svn.gnome.org/viewvc/libxml2?rev=3806&view=rev
Log:
* tree.c: set doc on last child tree in xmlAddChildList for
bug #546772. Fix problem adding an attribute via with xmlAddChild
reported by Kris Breuker.
Modified:
trunk/ChangeLog
trunk/tree.c
Modified: trunk/tree.c
==============================================================================
--- trunk/tree.c (original)
+++ trunk/tree.c Wed Dec 31 22:13:57 2008
@@ -3216,7 +3216,10 @@
cur = cur->next;
}
cur->parent = parent;
- cur->doc = parent->doc; /* the parent may not be linked to a doc ! */
+ /* the parent may not be linked to a doc ! */
+ if (cur->doc != parent->doc) {
+ xmlSetTreeDoc(cur, parent->doc);
+ }
parent->last = cur;
return(cur);
@@ -3309,9 +3312,7 @@
if (cur->type == XML_ATTRIBUTE_NODE) {
if (parent->type != XML_ELEMENT_NODE)
return(NULL);
- if (parent->properties == NULL) {
- parent->properties = (xmlAttrPtr) cur;
- } else {
+ if (parent->properties != NULL) {
/* check if an attribute with the same name exists */
xmlAttrPtr lastattr;
@@ -3326,8 +3327,13 @@
}
if (lastattr == (xmlAttrPtr) cur)
return(cur);
+
+ }
+ if (parent->properties == NULL) {
+ parent->properties = (xmlAttrPtr) cur;
+ } else {
/* find the end */
- lastattr = parent->properties;
+ xmlAttrPtr lastattr = parent->properties;
while (lastattr->next != NULL) {
lastattr = lastattr->next;
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]