diff options
author | Christian Grothoff <christian@grothoff.org> | 2009-09-22 17:33:51 +0000 |
---|---|---|
committer | Christian Grothoff <christian@grothoff.org> | 2009-09-22 17:33:51 +0000 |
commit | 377b5e6c3615d2d482cb3341520bd5e84a0704b7 (patch) | |
tree | 457c6951baceeb4212a6769a1e2e4926735dbcb5 /src/util/container_heap.c | |
parent | 9360aeb6e64646e9912642fc45d51e030003cb98 (diff) | |
download | gnunet-377b5e6c3615d2d482cb3341520bd5e84a0704b7.tar.gz gnunet-377b5e6c3615d2d482cb3341520bd5e84a0704b7.zip |
heap fixes
Diffstat (limited to 'src/util/container_heap.c')
-rw-r--r-- | src/util/container_heap.c | 19 |
1 files changed, 16 insertions, 3 deletions
diff --git a/src/util/container_heap.c b/src/util/container_heap.c index 7e41c40f2..fd5838f60 100644 --- a/src/util/container_heap.c +++ b/src/util/container_heap.c | |||
@@ -72,18 +72,31 @@ struct GNUNET_CONTAINER_Heap | |||
72 | 72 | ||
73 | }; | 73 | }; |
74 | 74 | ||
75 | |||
76 | /** | ||
77 | * Returns element stored at root of tree, doesn't effect anything | ||
78 | * | ||
79 | * @param heap the heap | ||
80 | * @return NULL if the heap is empty | ||
81 | */ | ||
82 | void *GNUNET_CONTAINER_heap_peek (struct GNUNET_CONTAINER_Heap *heap) | ||
83 | { | ||
84 | return heap->root; | ||
85 | } | ||
86 | |||
87 | |||
75 | void | 88 | void |
76 | internal_print (struct GNUNET_CONTAINER_heap_node *root) | 89 | internal_print (struct GNUNET_CONTAINER_heap_node *root) |
77 | { | 90 | { |
78 | fprintf (stdout, "%d\n", root->cost); | 91 | fprintf (stdout, "%llu\n", (unsigned long long) root->cost); |
79 | if (root->left_child != NULL) | 92 | if (root->left_child != NULL) |
80 | { | 93 | { |
81 | fprintf (stdout, "LEFT of %d\n", root->cost); | 94 | fprintf (stdout, "LEFT of %llu\n", (unsigned long long) root->cost); |
82 | internal_print (root->left_child); | 95 | internal_print (root->left_child); |
83 | } | 96 | } |
84 | if (root->right_child != NULL) | 97 | if (root->right_child != NULL) |
85 | { | 98 | { |
86 | fprintf (stdout, "RIGHT of %d\n", root->cost); | 99 | fprintf (stdout, "RIGHT of %llu\n", (unsigned long long) root->cost); |
87 | internal_print (root->right_child); | 100 | internal_print (root->right_child); |
88 | } | 101 | } |
89 | } | 102 | } |