diff options
| author | Ruben Beltran del Rio <git@r.bdr.sh> | 2026-06-29 17:43:03 +0000 |
|---|---|---|
| committer | Ruben Beltran del Rio <git@r.bdr.sh> | 2026-06-29 17:43:03 +0000 |
| commit | 25ccc2599aa722b0552193961d4cda15928112d8 (patch) | |
| tree | d562abe7d1539665aaa9861d0615f039d3ff7bfa /xs_list_tools.h | |
| parent | 6fc748933ad263ba0e8c78eb9ae1e085a2b0dfb2 (diff) | |
| parent | 795355acb496a8a8f015a80edf48f38786894f86 (diff) | |
Merge branch 'master' of https://codeberg.org/grunfink/snac2
Diffstat (limited to 'xs_list_tools.h')
| -rw-r--r-- | xs_list_tools.h | 24 |
1 files changed, 0 insertions, 24 deletions
diff --git a/xs_list_tools.h b/xs_list_tools.h index 33d4b87..f47d782 100644 --- a/xs_list_tools.h +++ b/xs_list_tools.h @@ -5,7 +5,6 @@ #define _XS_LIST_TOOLS_H xs_list *xs_list_insert_sorted(xs_list *list, const xs_val *nv); - xs_list *xs_list_reverse(const xs_list *l); xs_val **xs_list_to_array(const xs_list *l, int *len); int xs_list_sort_cmp(const void *p1, const void *p2); int xs_list_sort_inv_cmp(const void *p1, const void *p2); @@ -37,29 +36,6 @@ xs_list *xs_list_insert_sorted(xs_list *list, const xs_val *nv) } -xs_list *xs_list_reverse(const xs_list *l) -/* creates a new list as a reverse version of l */ -{ - xs_list *n = xs_dup(l); - const xs_val *v; - - /* move to one byte before the EOM */ - char *p = n + xs_size(n) - 1; - - xs_list_foreach(l, v) { - /* size of v, plus the LITEM */ - int z = xs_size(v) + 1; - - p -= z; - - /* copy v, including its LITEM */ - memcpy(p, v - 1, z); - } - - return n; -} - - xs_val **xs_list_to_array(const xs_list *l, int *len) /* converts a list to an array of values */ /* must be freed after use */ |