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; }