From 683ee76ad23371a3fc0543ab35445f237820572c Mon Sep 17 00:00:00 2001 From: =?utf8?q?P=C3=A1draig=20Brady?= Date: Tue, 30 Aug 2011 15:09:23 +0100 Subject: [PATCH] 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(-) diff --git a/gl/lib/heap.c b/gl/lib/heap.c index 027b5cd3c3..d7db440d72 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); -- 2.47.2