packages/libs/ezxml/patches/203-ezxml_cut.patch
rhk b1a51aa240 [packages] ezxml: update PKG_RELEASE and rename patches
git-svn-id: svn://svn.openwrt.org/openwrt/packages@23054 3c298f89-4303-0410-b956-a3cf2f4a3e73
2010-09-13 14:53:50 +00:00

24 lines
1.1 KiB
Diff

--- a/ezxml.c
+++ b/ezxml.c
@@ -1042,7 +1042,7 @@ ezxml_t ezxml_cut(ezxml_t xml)
cur = xml->parent->child; // go back to head of subtag list
if (strcmp(cur->name, xml->name)) { // not in first sibling list
- while (strcmp(cur->sibling->name, xml->name))
+ while (cur->sibling && strcmp(cur->sibling->name, xml->name))
cur = cur->sibling;
if (cur->sibling == xml) { // first of a sibling list
cur->sibling = (xml->next) ? xml->next
@@ -1051,8 +1051,9 @@ ezxml_t ezxml_cut(ezxml_t xml)
else cur = cur->sibling; // not first of a sibling list
}
- while (cur->next && cur->next != xml) cur = cur->next;
- if (cur->next) cur->next = cur->next->next; // patch next list
+ cur = xml->parent->child; // go back to head of subtag list
+ while (cur && cur->next != xml) cur = cur->ordered;
+ if (cur && cur->next) cur->next = cur->next->next; // patch next list
}
}
xml->ordered = xml->sibling = xml->next = NULL;