summaryrefslogtreecommitdiff
path: root/xs.h
diff options
context:
space:
mode:
authorGravatar default2023-07-05 09:51:41 +0200
committerGravatar default2023-07-05 09:51:41 +0200
commitc47df7634e693736c31a446bb432fc036ead0513 (patch)
tree7cf13583b0e301cf1be27c99f5ca98e56298b58b /xs.h
parentBackport from xs. (diff)
downloadsnac2-c47df7634e693736c31a446bb432fc036ead0513.tar.gz
snac2-c47df7634e693736c31a446bb432fc036ead0513.tar.xz
snac2-c47df7634e693736c31a446bb432fc036ead0513.zip
Backport from xs.
Diffstat (limited to 'xs.h')
-rw-r--r--xs.h12
1 files changed, 12 insertions, 0 deletions
diff --git a/xs.h b/xs.h
index f892472..ad8a35d 100644
--- a/xs.h
+++ b/xs.h
@@ -96,6 +96,7 @@ int xs_list_in(const xs_list *list, const xs_val *val);
96xs_str *xs_join(const xs_list *list, const char *sep); 96xs_str *xs_join(const xs_list *list, const char *sep);
97xs_list *xs_split_n(const char *str, const char *sep, int times); 97xs_list *xs_split_n(const char *str, const char *sep, int times);
98#define xs_split(str, sep) xs_split_n(str, sep, XS_ALL) 98#define xs_split(str, sep) xs_split_n(str, sep, XS_ALL)
99xs_list *xs_list_cat(xs_list *l1, const xs_list *l2);
99 100
100xs_dict *xs_dict_new(void); 101xs_dict *xs_dict_new(void);
101xs_dict *xs_dict_append_m(xs_dict *dict, const xs_str *key, const xs_val *mem, int dsz); 102xs_dict *xs_dict_append_m(xs_dict *dict, const xs_str *key, const xs_val *mem, int dsz);
@@ -858,6 +859,17 @@ xs_list *xs_split_n(const char *str, const char *sep, int times)
858} 859}
859 860
860 861
862xs_list *xs_list_cat(xs_list *l1, const xs_list *l2)
863/* concatenates list l2 to l1 */
864{
865 XS_ASSERT_TYPE(l1, XSTYPE_LIST);
866 XS_ASSERT_TYPE(l2, XSTYPE_LIST);
867
868 /* inserts at the end of l1 the content of l2 (skipping header and footer) */
869 return xs_insert_m(l1, xs_size(l1) - 1, l2 + 4, xs_size(l2) - 5);
870}
871
872
861/** dicts **/ 873/** dicts **/
862 874
863xs_dict *xs_dict_new(void) 875xs_dict *xs_dict_new(void)