[packages] ezxml: clean patch headers and new ezxml_cut patch
[openwrt/svn-archive/archive.git] / libs / ezxml / patches / 500-ezxml_cut.patch
1 --- a/ezxml.c
2 +++ b/ezxml.c
3 @@ -1042,7 +1042,7 @@ ezxml_t ezxml_cut(ezxml_t xml)
4
5 cur = xml->parent->child; // go back to head of subtag list
6 if (strcmp(cur->name, xml->name)) { // not in first sibling list
7 - while (strcmp(cur->sibling->name, xml->name))
8 + while (cur->sibling && strcmp(cur->sibling->name, xml->name))
9 cur = cur->sibling;
10 if (cur->sibling == xml) { // first of a sibling list
11 cur->sibling = (xml->next) ? xml->next
12 @@ -1051,8 +1051,9 @@ ezxml_t ezxml_cut(ezxml_t xml)
13 else cur = cur->sibling; // not first of a sibling list
14 }
15
16 - while (cur->next && cur->next != xml) cur = cur->next;
17 - if (cur->next) cur->next = cur->next->next; // patch next list
18 + cur = xml->parent->child; // go back to head of subtag list
19 + while (cur && cur->next != xml) cur = cur->ordered;
20 + if (cur && cur->next) cur->next = cur->next->next; // patch next list
21 }
22 }
23 xml->ordered = xml->sibling = xml->next = NULL;