summaryrefslogtreecommitdiffstats
path: root/common/list.c
diff options
context:
space:
mode:
authorLibravatar Drew DeVault <sir@cmpwn.com>2015-12-21 20:42:08 -0500
committerLibravatar Drew DeVault <sir@cmpwn.com>2015-12-21 20:42:08 -0500
commit91c102a897467ff1bae345458ccf096e32e7bd15 (patch)
tree104c612d08afef1566c9b56f962641bb39c0dc1b /common/list.c
parentMerge pull request #391 from mikkeloscar/trigger-workspace-ipc (diff)
parentreplace non-standard qsort_r with qsort (diff)
downloadsway-91c102a897467ff1bae345458ccf096e32e7bd15.tar.gz
sway-91c102a897467ff1bae345458ccf096e32e7bd15.tar.zst
sway-91c102a897467ff1bae345458ccf096e32e7bd15.zip
Merge pull request #393 from robotanarchy/musl-libc-compatibility
musl libc compatibility
Diffstat (limited to 'common/list.c')
-rw-r--r--common/list.c10
1 files changed, 2 insertions, 8 deletions
diff --git a/common/list.c b/common/list.c
index d6f6f2ea..850c8569 100644
--- a/common/list.c
+++ b/common/list.c
@@ -50,14 +50,8 @@ void list_cat(list_t *list, list_t *source) {
50 } 50 }
51} 51}
52 52
53// pass the pointer of the object we care about to the comparison function 53void list_qsort(list_t* list, int compare(const void *left, const void *right)) {
54static int list_cmp(const void *l, const void *r, void *_cmp) { 54 qsort(list->items, list->length, sizeof(void *), compare);
55 int (*cmp)(const void *, const void *) = _cmp;
56 return cmp(*(void**)l, *(void**)r);
57}
58
59void list_sort(list_t *list, int compare(const void *left, const void *right)) {
60 qsort_r(list->items, list->length, sizeof(void *), list_cmp, compare);
61} 55}
62 56
63int list_seq_find(list_t *list, int compare(const void *item, const void *data), const void *data) { 57int list_seq_find(list_t *list, int compare(const void *item, const void *data), const void *data) {