diff options
author | Rafael G. Martins <rafael@rafaelmartins.eng.br> | 2020-05-29 01:23:08 +0200 |
---|---|---|
committer | Rafael G. Martins <rafael@rafaelmartins.eng.br> | 2020-05-29 01:23:08 +0200 |
commit | bec4fd31fd9f36dbcdad9d443a0c609adde1af67 (patch) | |
tree | 18fa9cb7675072dff4bf251da25444e8635880a1 /src/common | |
parent | 050d32ae204b64f7098b12c77cdb92a33ebc7562 (diff) | |
download | blogc-bec4fd31fd9f36dbcdad9d443a0c609adde1af67.tar.gz blogc-bec4fd31fd9f36dbcdad9d443a0c609adde1af67.tar.bz2 blogc-bec4fd31fd9f36dbcdad9d443a0c609adde1af67.zip |
common: utils: added bc_slist_append_list
Diffstat (limited to 'src/common')
-rw-r--r-- | src/common/utils.c | 16 | ||||
-rw-r--r-- | src/common/utils.h | 1 |
2 files changed, 17 insertions, 0 deletions
diff --git a/src/common/utils.c b/src/common/utils.c index f686222..4e90c77 100644 --- a/src/common/utils.c +++ b/src/common/utils.c @@ -74,6 +74,22 @@ bc_slist_prepend(bc_slist_t *l, void *data) } +bc_slist_t* +bc_slist_append_list(bc_slist_t *l, bc_slist_t *n) +{ + if (l == NULL) { + return n; + } + if (n == NULL) { + return l; + } + bc_slist_t *tmp; + for (tmp = l; tmp->next != NULL; tmp = tmp->next); + tmp->next = n; + return l; +} + + void bc_slist_free_full(bc_slist_t *l, bc_free_func_t free_func) { diff --git a/src/common/utils.h b/src/common/utils.h index 94c3356..84ce066 100644 --- a/src/common/utils.h +++ b/src/common/utils.h @@ -31,6 +31,7 @@ typedef struct _bc_slist_t { bc_slist_t* bc_slist_append(bc_slist_t *l, void *data); bc_slist_t* bc_slist_prepend(bc_slist_t *l, void *data); +bc_slist_t* bc_slist_append_list(bc_slist_t *l, bc_slist_t *n); void bc_slist_free(bc_slist_t *l); void bc_slist_free_full(bc_slist_t *l, bc_free_func_t free_func); size_t bc_slist_length(bc_slist_t *l); |