d1a9d0f8693e766b2214e65c1bcd6942a4718d5a kent Sat Dec 19 11:28:13 2020 -0800 Adding a sortStrings function as a little wrapper around qsort for an array of char *'s. Also added microoptimization to doubleSort diff --git src/inc/common.h src/inc/common.h index b5ea818..f15e96b 100644 --- src/inc/common.h +++ src/inc/common.h @@ -332,30 +332,34 @@ void reverseBytes(char *bytes, long length); /* Reverse the order of the bytes. */ void reverseInts(int *a, int length); /* Reverse the order of the integer array. */ void reverseUnsigned(unsigned *a, int length); /* Reverse the order of the unsigned array. */ void reverseDoubles(double *a, int length); /* Reverse the order of the double array. */ void reverseStrings(char **a, int length); /* Reverse the order of the char* array. */ +void sortStrings(char **array, int count); +/* Sort array using strcmp */ + + void swapBytes(char *a, char *b, int length); /* Swap buffers a and b. */ /******* Some things to manage simple lists - structures that begin ****** ******* with a pointer to the next element in the list. ******/ struct slList { struct slList *next; }; int slCount(const void *list); /* Return # of elements in list. */ void *slElementFromIx(void *list, int ix); /* Return the ix'th element in list. Returns NULL