-diff -pruN ezxml-0.8.6.orig/GNUmakefile ezxml-0.8.6/GNUmakefile
---- ezxml-0.8.6.orig/GNUmakefile 2007-08-30 17:38:55.000000000 +0200
-+++ ezxml-0.8.6/GNUmakefile 2007-08-30 17:41:12.000000000 +0200
+--- a/GNUmakefile
++++ b/GNUmakefile
@@ -21,10 +21,10 @@
# TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
# SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
-diff -pruN ezxml-0.8.6.orig/GNUmakefile ezxml-0.8.6/GNUmakefile
---- ezxml-0.8.6.orig/GNUmakefile 2008-12-16 15:22:46.773434689 +0100
-+++ ezxml-0.8.6/GNUmakefile 2008-12-16 15:22:27.337440224 +0100
+--- a/GNUmakefile
++++ b/GNUmakefile
@@ -28,6 +28,7 @@ RM = rm -f
DEBUG_CFLAGS = -O0 -g
OBJS = ezxml.o
-diff -pruN ezxml-0.8.6.orig/ezxml.c ezxml-0.8.6/ezxml.c
---- ezxml-0.8.6.orig/ezxml.c 2006-06-08 04:33:38.000000000 +0200
-+++ ezxml-0.8.6/ezxml.c 2008-02-15 14:35:17.000000000 +0100
-@@ -599,6 +599,19 @@ ezxml_t ezxml_parse_str(char *s, size_t
+--- a/ezxml.c
++++ b/ezxml.c
+@@ -599,6 +599,19 @@ ezxml_t ezxml_parse_str(char *s, size_t
else return ezxml_err(root, d, "unclosed tag <%s>", root->cur->name);
}
// Wrapper for ezxml_parse_str() that accepts a file stream. Reads the entire
// stream into memory and then parses it. For xml files, use ezxml_parse_file()
// or ezxml_parse_fd()
-diff -pruN ezxml-0.8.6.orig/ezxml.h ezxml-0.8.6/ezxml.h
---- ezxml-0.8.6.orig/ezxml.h 2006-06-08 03:57:30.000000000 +0200
-+++ ezxml-0.8.6/ezxml.h 2008-02-15 14:37:15.000000000 +0100
+--- a/ezxml.h
++++ b/ezxml.h
@@ -59,6 +59,11 @@ struct ezxml {
// pass in the copy. Returns NULL on failure.
ezxml_t ezxml_parse_str(char *s, size_t len);
-diff -pruN ezxml-0.8.6.orig/ezxml.c ezxml-0.8.6/ezxml.c
---- ezxml-0.8.6.orig/ezxml.c 2008-12-16 17:02:17.262312778 +0100
-+++ ezxml-0.8.6/ezxml.c 2008-12-16 17:03:24.231073153 +0100
+--- a/ezxml.c
++++ b/ezxml.c
@@ -25,6 +25,7 @@
#include <stdlib.h>
#include <stdio.h>
// sets a flag for the given tag and returns the tag
ezxml_t ezxml_set_flag(ezxml_t xml, short flag)
{
-diff -pruN ezxml-0.8.6.orig/ezxml.h ezxml-0.8.6/ezxml.h
---- ezxml-0.8.6.orig/ezxml.h 2008-12-16 17:02:17.262312778 +0100
-+++ ezxml-0.8.6/ezxml.h 2008-12-16 17:03:44.189450448 +0100
+--- a/ezxml.h
++++ b/ezxml.h
@@ -95,9 +95,13 @@ ezxml_t ezxml_idx(ezxml_t xml, int idx);
// returns the given tag's character content or empty string if none
#define ezxml_txt(xml) ((xml) ? xml->txt : "")
-diff -pruN ezxml-0.8.6.orig/ezxml.h ezxml-0.8.6/ezxml.h
---- ezxml-0.8.6.orig/ezxml.h 2008-12-16 17:07:47.585487234 +0100
-+++ ezxml-0.8.6/ezxml.h 2008-12-16 17:08:29.037939949 +0100
+--- a/ezxml.h
++++ b/ezxml.h
@@ -175,6 +175,17 @@ ezxml_t ezxml_insert(ezxml_t xml, ezxml_
// removes a tag along with all its subtags
#define ezxml_remove(xml) ezxml_free(ezxml_cut(xml))
--- /dev/null
+--- 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;