sort: make struct heap private
authorPaul R. Eggert <eggert@cs.ucla.edu>
Mon, 26 Jul 2010 04:18:14 +0000 (21:18 -0700)
committerPaul Eggert <eggert@cs.ucla.edu>
Mon, 26 Jul 2010 04:18:35 +0000 (21:18 -0700)
* gl/lib/heap.c (struct heap): Move this here...
* gl/lib/heap.h (struct heap): ... from here, as outside code no
longer needs to access any of these members.

gl/lib/heap.c
gl/lib/heap.h

index baf9a27..80ea70e 100644 (file)
@@ -30,6 +30,13 @@ static size_t heapify_down (void **, size_t, size_t,
 static void heapify_up (void **, size_t,
                         int (*) (void const *, void const *));
 
+struct heap
+{
+  void **array;     /* array[0] is not used */
+  size_t capacity;  /* Array size */
+  size_t count;     /* Used as index to last element. Also is num of items. */
+  int (*compare) (void const *, void const *);
+};
 
 /* Allocate memory for the heap. */
 
index b61adf6..cbfeb04 100644 (file)
 
 #include <stddef.h>
 
-struct heap
-{
-  void **array;     /* array[0] is not used */
-  size_t capacity;  /* Array size */
-  size_t count;     /* Used as index to last element. Also is num of items. */
-  int (*compare) (void const *, void const *);
-};
-
 struct heap *heap_alloc (int (*) (void const *, void const *), size_t);
 void heap_free (struct heap *);
 int heap_insert (struct heap *heap, void *item);