This is my code :
gint compare_ulong_function (gconstpointer a, gconstpointer b)
{
return *(unsigned long *)a - *(unsigned long *)b;
}
GArray* build_priority_queue(unsigned char* const input_data, unsigned int const input_size)
{
GArray* priority_queue = g_array_sized_new(FALSE, TRUE, sizeof(unsigned long), 256);
int i;
for (i = 0; i < input_size; i++)
g_array_index(priority_queue, unsigned long, input_data[i])++;
g_array_sort(priority_queue, compare_ulong_function);
return priority_queue;
}
When I debug the g_array_sort is called (can't go into the function missing development package and can't install it) but the array isn't sorted. The compare_ulong_function is never called.