From 683ee76ad23371a3fc0543ab35445f237820572c Mon Sep 17 00:00:00 2001 From: Pádraig Brady Date: Tue, 30 Aug 2011 15:09:23 +0100 Subject: build: heap.c: make possible gnulib candidate c89 compatible * gl/lib/heap.c: Move declaration to the top of scope. Reported by Rob McMahon and Wolfgang Steinwender in relation to "Sun WorkShop 6 update 2 C 5.3 Patch 111679-12 2003/05/18" and "GCC 2.95.3" respectively. --- gl/lib/heap.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'gl') diff --git a/gl/lib/heap.c b/gl/lib/heap.c index 027b5cd3c..d7db440d7 100644 --- a/gl/lib/heap.c +++ b/gl/lib/heap.c @@ -93,10 +93,12 @@ heap_insert (struct heap *heap, void *item) void * heap_remove_top (struct heap *heap) { + void *top; + if (heap->count == 0) return NULL; - void *top = heap->array[1]; + top = heap->array[1]; heap->array[1] = heap->array[heap->count--]; heapify_down (heap->array, heap->count, 1, heap->compare); -- cgit v1.2.3-70-g09d2