summaryrefslogtreecommitdiff
path: root/lichen.h
diff options
context:
space:
mode:
authorsanine <sanine.not@pm.me>2025-10-24 15:31:04 -0500
committersanine <sanine.not@pm.me>2025-10-24 15:31:04 -0500
commitb5c5579402d442de131746b7086c8248bc188205 (patch)
treef646dcd774ce751092e901aa76cc120ffcf3c205 /lichen.h
parent9d35ddb703d7ba22bdd6cdbaaf3b5c992ec79025 (diff)
add failing sort testlichen-c
Diffstat (limited to 'lichen.h')
-rw-r--r--lichen.h5
1 files changed, 4 insertions, 1 deletions
diff --git a/lichen.h b/lichen.h
index 5f13e85..3a8cce9 100644
--- a/lichen.h
+++ b/lichen.h
@@ -49,10 +49,13 @@ typedef struct li_ll_t {
struct li_ll_t * li_alloc_ll();
// free a linked list
void li_free_ll(struct li_ll_t *list, void (*free_data)(void*));
+// prepend and append to a linked list
int li_ll_append(struct li_ll_t *list, void *data);
int li_ll_prepend(struct li_ll_t *list, void *data);
+// copy a linked list. !!! WARNING !!! if this function fails (returns nonzero) you MUST call li_free_ll on dst yourself!
int li_copy_list(struct li_ll_t **dst, struct li_ll_t *src, void *(*copy_data)(void*));
-
+// sort a list. compare_data should return a positive, negative or zero value of the same sign as (a-b)
+int li_sort_list(struct li_ll_t *list, int (*compare_data)(void *, void*));