r4561 takkaria - /trunk/hubbub/test/tree2.c

netsurf at semichrome.net netsurf at semichrome.net
Thu Jul 10 12:27:18 BST 2008


Author: takkaria
Date: Thu Jul 10 06:27:17 2008
New Revision: 4561

URL: http://source.netsurf-browser.org?rev=4561&view=rev
Log:
Fix another bug in the test harness.

Modified:
    trunk/hubbub/test/tree2.c

Modified: trunk/hubbub/test/tree2.c
URL: http://source.netsurf-browser.org/trunk/hubbub/test/tree2.c?rev=4561&r1=4560&r2=4561&view=diff
==============================================================================
--- trunk/hubbub/test/tree2.c (original)
+++ trunk/hubbub/test/tree2.c Thu Jul 10 06:27:17 2008
@@ -192,6 +192,11 @@
 {
 	size_t len = strlen(str) + 1;
 
+	if (!buf) {
+		printf("%s", str);
+		return;
+	}
+
 	if (buf->buf == NULL) {
 		buf->len = ((len + 1024) / 1024) * 1024;
 		buf->buf = calloc(1, buf->len);
@@ -418,7 +423,15 @@
 	node_t *insert = NULL;
 
 	tchild->parent = tparent;
-	tchild->child = tchild->next = tchild->prev = NULL;
+	tchild->next = tchild->prev = NULL;
+
+#ifndef NDEBUG
+	printf("appending (%x):\n", (unsigned)tchild);
+	node_print(NULL, tchild, 0);
+	printf("to:\n");
+	if (parent != (void *)1)
+		node_print(NULL, tparent, 0);
+#endif
 
 	if (parent == (void *)1) {
 		if (Document) {
@@ -476,10 +489,11 @@
 	node_t *tchild = child;
 
 	assert(tparent->child);
-
-
-	if (tchild->parent->child == tchild)
+	assert(tchild->parent == tparent);
+
+	if (tchild->parent->child == tchild) {
 		tchild->parent->child = tchild->next;
+	}
 
 	if (tchild->prev)
 		tchild->prev->next = tchild->next;




More information about the netsurf-commits mailing list