From c4f51b1311d0e0ec2ca7c2a0b80312c9999bbfc8 Mon Sep 17 00:00:00 2001 From: Eric Biggers Date: Mon, 29 Aug 2016 00:04:22 -0700 Subject: [PATCH] Rename heapsort() to heap_sort() to avoid naming collision --- lib/deflate_compress.c | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/lib/deflate_compress.c b/lib/deflate_compress.c index 8d9037a..2637302 100644 --- a/lib/deflate_compress.c +++ b/lib/deflate_compress.c @@ -586,9 +586,15 @@ heapify_array(u32 A[], unsigned length) heapify_subtree(A, length, subtree_idx); } -/* Sort the array 'A', which contains 'length' unsigned 32-bit integers. */ +/* + * Sort the array 'A', which contains 'length' unsigned 32-bit integers. + * + * Note: name this function heap_sort() instead of heapsort() to avoid colliding + * with heapsort() from stdlib.h on BSD-derived systems --- though this isn't + * necessary when compiling with -D_ANSI_SOURCE, which is the better solution. + */ static void -heapsort(u32 A[], unsigned length) +heap_sort(u32 A[], unsigned length) { A--; /* Use 1-based indices */ @@ -696,8 +702,8 @@ sort_symbols(unsigned num_syms, const u32 freqs[restrict], } /* Sort the symbols counted in the last counter. */ - heapsort(symout + counters[num_counters - 2], - counters[num_counters - 1] - counters[num_counters - 2]); + heap_sort(symout + counters[num_counters - 2], + counters[num_counters - 1] - counters[num_counters - 2]); return num_used_syms; }