bug-coreutils
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

bug#6730: [PATCH] sort: make struct heap private


From: Paul Eggert
Subject: bug#6730: [PATCH] sort: make struct heap private
Date: Sun, 25 Jul 2010 21:22:16 -0700
User-agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.9.1.10) Gecko/20100527 Thunderbird/3.0.5

>From d36d5c8029fd24a3f8e1e443007ba9a1c8f243e6 Mon Sep 17 00:00:00 2001
From: Paul R. Eggert <address@hidden>
Date: Sun, 25 Jul 2010 21:18:14 -0700
Subject: [PATCH] sort: make struct heap private

* 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 |    7 +++++++
 gl/lib/heap.h |    8 --------
 2 files changed, 7 insertions(+), 8 deletions(-)

diff --git a/gl/lib/heap.c b/gl/lib/heap.c
index baf9a27..80ea70e 100644
--- a/gl/lib/heap.c
+++ b/gl/lib/heap.c
@@ -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. */
 
diff --git a/gl/lib/heap.h b/gl/lib/heap.h
index b61adf6..cbfeb04 100644
--- a/gl/lib/heap.h
+++ b/gl/lib/heap.h
@@ -20,14 +20,6 @@
 
 #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);
-- 
1.7.1






reply via email to

[Prev in Thread] Current Thread [Next in Thread]