Rename heapsort() to heap_sort() to avoid naming collision

This commit is contained in:
Eric Biggers 2016-08-29 00:04:22 -07:00
parent e603f7868d
commit c4f51b1311

View File

@ -586,9 +586,15 @@ heapify_array(u32 A[], unsigned length)
heapify_subtree(A, length, subtree_idx); 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 static void
heapsort(u32 A[], unsigned length) heap_sort(u32 A[], unsigned length)
{ {
A--; /* Use 1-based indices */ 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. */ /* Sort the symbols counted in the last counter. */
heapsort(symout + counters[num_counters - 2], heap_sort(symout + counters[num_counters - 2],
counters[num_counters - 1] - counters[num_counters - 2]); counters[num_counters - 1] - counters[num_counters - 2]);
return num_used_syms; return num_used_syms;
} }