[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[GNUnet-SVN] r8644 - gnunet/src/util
From: |
gnunet |
Subject: |
[GNUnet-SVN] r8644 - gnunet/src/util |
Date: |
Wed, 8 Jul 2009 12:54:19 -0600 |
Author: grothoff
Date: 2009-07-08 12:54:19 -0600 (Wed, 08 Jul 2009)
New Revision: 8644
Modified:
gnunet/src/util/container_heap.c
gnunet/src/util/test_container_heap.c
Log:
forward-porting heap bugfixes
Modified: gnunet/src/util/container_heap.c
===================================================================
--- gnunet/src/util/container_heap.c 2009-07-08 18:54:08 UTC (rev 8643)
+++ gnunet/src/util/container_heap.c 2009-07-08 18:54:19 UTC (rev 8644)
@@ -331,6 +331,8 @@
if (del_node == NULL)
return NULL;
+ else if (del_node == root->root)
+ return GNUNET_CONTAINER_heap_remove_root (root);
ret = del_node->element;
last = getPos (root, root->size);
@@ -410,6 +412,15 @@
ret = root_node->element;
last = getPos (root, root->size);
+ if ((root_node == last) && (root->size == 1))
+ {
+ /* We are removing the last node in the heap! */
+ root->root = NULL;
+ root->traversal_pos = NULL;
+ root->size = 0;
+ return ret;
+ }
+
if (last->parent->left_child == last)
last->parent->left_child = NULL;
else if (last->parent->right_child == last)
Modified: gnunet/src/util/test_container_heap.c
===================================================================
--- gnunet/src/util/test_container_heap.c 2009-07-08 18:54:08 UTC (rev
8643)
+++ gnunet/src/util/test_container_heap.c 2009-07-08 18:54:19 UTC (rev
8644)
@@ -106,6 +106,7 @@
GNUNET_CONTAINER_heap_iterate (myHeap, iterator_callback, NULL);
fprintf (stdout, "\n");
+ GNUNET_CONTAINER_heap_destroy (myHeap);
return 0;
}
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [GNUnet-SVN] r8644 - gnunet/src/util,
gnunet <=