Before, the grf_sort() function looked like this:
Code: Select all
static void GRF_qsort (Grf *grf, uint32_t left, uint32_t right, GrfSortCallback callback);
GRFEXPORT void grf_sort (Grf *grf, GrfSortCallback callback)
{
GRF_qsort(grf, 0, grf->nfiles-1, callback);
}
Code: Select all
void qsort( void * base, size_t num, size_t size, int ( * comparator ) ( const void *, const void * ) );
GRFEXPORT void grf_sort (Grf *grf, int(*compar)(const void *, const void *))
{
qsort(grf->files, grf->nfiles-1, sizeof(GrfFile), compar);
}
I only noticed this by looking at the code; I do not know if this incomplete sort has any effect on the correctness of the library. The comments in grf_find_unused() explicitly warn about the array being sorted, however I think it will just cause a potentially useable empty block to not be used when saving new data.