9d4b252b61d22b312478d74946dee56cf2338158 tdreszer Tue Feb 5 17:38:12 2013 -0800 Should have been checked in with common.c. Added slSortMerge and slSortMergeUniq at Angie's request. diff --git src/inc/common.h src/inc/common.h index cd16de6..b2a1376 100644 --- src/inc/common.h +++ src/inc/common.h @@ -417,30 +417,38 @@ */ typedef int CmpFunction(const void *elem1, const void *elem2); void slSort(void *pList, CmpFunction *compare); /* Sort a singly linked list with Qsort and a temporary array. * The arguments to the compare function in real, non-void, life * are pointers to pointers. */ void slUniqify(void *pList, CmpFunction *compare, void (*free)()); /* Return sorted list with duplicates removed. * Compare should be same type of function as slSort's compare (taking * pointers to pointers to elements. Free should take a simple * pointer to dispose of duplicate element, and can be NULL. */ +void slSortMerge(void *pA, void *b, CmpFunction *compare); +// Merges and sorts a pair of singly linked lists using slSort. + +void slSortMergeUniq(void *pA, void *b, CmpFunction *compare, void (*free)()); +// Merges and sorts a pair of singly linked lists leaving only unique +// items via slUniqufy. duplicate itens are defined by the compare routine +// returning 0. If free is provided, items dropped from list can disposed of. + boolean slRemoveEl(void *vpList, void *vToRemove); /* Remove element from doubly linked list. Usage: * slRemove(&list, el); * Returns TRUE if element in list. */ void slFreeList(void *listPt); /* Free all elements in list and set list pointer to null. * Usage: * slFreeList(&list); */ struct slInt /* List of integers. */ { struct slInt *next; /* Next in list. */