1
0
mirror of https://github.com/cc65/cc65.git synced 2024-12-25 17:29:50 +00:00

Added a sort function

git-svn-id: svn://svn.cc65.org/cc65/trunk@418 b7a2c559-68d2-44c3-8de9-860c34a00d81
This commit is contained in:
cuz 2000-10-31 18:25:52 +00:00
parent cb762d9d7c
commit 0899e279b3
2 changed files with 19 additions and 1 deletions

View File

@ -33,6 +33,7 @@
#include <stdlib.h>
#include <string.h> #include <string.h>
/* common */ /* common */
@ -224,4 +225,15 @@ void CollReplace (Collection* C, void* Item, unsigned Index)
void CollSort (Collection* C, int (*Compare) (const void*, const void*))
/* Sort the collection using the given compare function.
* BEWARE: The function uses qsort internally, so the Compare function does
* actually get pointers to the object pointers, not just object pointers!
*/
{
/* Use qsort */
qsort (C->Items, C->Count, sizeof (void*), Compare);
}

View File

@ -113,6 +113,12 @@ void CollReplace (Collection* C, void* Item, unsigned Index);
* just the pointer will et replaced. * just the pointer will et replaced.
*/ */
void CollSort (Collection* C, int (*Compare) (const void*, const void*));
/* Sort the collection using the given compare function.
* BEWARE: The function uses qsort internally, so the Compare function does
* actually get pointers to the object pointers, not just object pointers!
*/
/* End of exprlist.h */ /* End of exprlist.h */