~vcs-imports/gnunet/trunk

« back to all changes in this revision

Viewing changes to src/util/containers/heaptest.c

  • Committer: nevans
  • Date: 2010-02-07 19:33:11 UTC
  • Revision ID: svn-v4:140774ce-b5e7-0310-ab8b-a85725594a96:GNUnet:10246
revert broken heap changes

Show diffs side-by-side

added added

removed removed

Lines of Context:
49
49
  unsigned int cost;
50
50
};
51
51
 
52
 
static struct GNUNET_CONTAINER_Heap *minHeap;
53
 
static struct GNUNET_CONTAINER_Heap *maxHeap;
54
 
 
55
 
static int
56
 
iterator_callback (void *cls,
57
 
                   struct GNUNET_CONTAINER_HeapNode * node,
58
 
                   void *element,
59
 
                   GNUNET_CONTAINER_HeapCostType cost)
60
 
{
61
 
  struct GNUNET_neighbor *neighbor = element;
62
 
#if DEBUG
63
 
  fprintf(stderr, "Iterating, at neighbor %u with cost %u\n", neighbor->neighbor, neighbor->cost);
64
 
#endif
65
 
  GNUNET_CONTAINER_heap_remove_node (maxHeap, node);
66
 
  return GNUNET_YES;
67
 
 
68
 
}
69
52
 
70
53
int
71
54
main (int argc, char **argv)
72
55
{
 
56
 
 
57
  struct GNUNET_CONTAINER_Heap *minHeap;
 
58
  struct GNUNET_CONTAINER_Heap *maxHeap;
73
59
  int i;
74
60
  int ret;
75
61
  int cur_pos = 0;
151
137
        return GNUNET_SYSERR;
152
138
 
153
139
    }
154
 
 
155
 
  GNUNET_CONTAINER_heap_iterate(maxHeap, &iterator_callback, NULL);
156
 
 
157
140
  while (GNUNET_CONTAINER_heap_get_size (maxHeap) > 0)
158
141
    {
159
142
      GNUNET_CONTAINER_heap_remove_root (maxHeap);