diff options
author | Campbell Barton <ideasman42@gmail.com> | 2015-06-11 08:13:06 +0300 |
---|---|---|
committer | Campbell Barton <ideasman42@gmail.com> | 2015-06-11 14:54:06 +0300 |
commit | 867cd2048e0e8dd9f0552ac996bb1d352136b9a0 (patch) | |
tree | 81dc9e65a3d1495779970eded4ed22d99c6aafbe /source/blender/blenlib/BLI_linklist.h | |
parent | b8b57d2da99acca0d68035315b159174a8570271 (diff) |
Replace linked-list insert-sort with merge-sort
Original code from eglib, modified for reuse with multiple linked-list implementations.
Adds sort functions: BLI_linklist_sort, BLI_linklist_sort_r
Diffstat (limited to 'source/blender/blenlib/BLI_linklist.h')
-rw-r--r-- | source/blender/blenlib/BLI_linklist.h | 2 |
1 files changed, 2 insertions, 0 deletions
diff --git a/source/blender/blenlib/BLI_linklist.h b/source/blender/blenlib/BLI_linklist.h index 8dbf7b4a908..d0dc7fc7b2f 100644 --- a/source/blender/blenlib/BLI_linklist.h +++ b/source/blender/blenlib/BLI_linklist.h @@ -74,6 +74,8 @@ void BLI_linklist_free(struct LinkNode *list, LinkNodeFreeFP freefunc); void BLI_linklist_freeN(struct LinkNode *list); void BLI_linklist_free_pool(LinkNode *list, LinkNodeFreeFP freefunc, struct BLI_mempool *mempool); void BLI_linklist_apply(struct LinkNode *list, LinkNodeApplyFP applyfunc, void *userdata); +struct LinkNode *BLI_linklist_sort(LinkNode *list, int (*cmp)(const void *, const void *)); +struct LinkNode *BLI_linklist_sort_r(LinkNode *list, int (*cmp)(void *, const void *, const void *), void *thunk); #define BLI_linklist_prepend_alloca(listp, ptr) \ BLI_linklist_prepend_nlink(listp, ptr, alloca(sizeof(LinkNode))) |