diff options
author | Tomasz Kramkowski <tk@the-tk.com> | 2018-02-28 00:35:15 +0000 |
---|---|---|
committer | Tomasz Kramkowski <tk@the-tk.com> | 2018-03-01 11:48:15 +0000 |
commit | 364eea8654a69dd0e79cdfa86c10992e6e275ccd (patch) | |
tree | b771e8ced2e4d0a4a0a8822bc49a6316cc14fd8b /strlist.c | |
download | vulkan-364eea8654a69dd0e79cdfa86c10992e6e275ccd.tar.gz vulkan-364eea8654a69dd0e79cdfa86c10992e6e275ccd.tar.xz vulkan-364eea8654a69dd0e79cdfa86c10992e6e275ccd.zip |
init commit
Diffstat (limited to 'strlist.c')
-rw-r--r-- | strlist.c | 24 |
1 files changed, 24 insertions, 0 deletions
diff --git a/strlist.c b/strlist.c new file mode 100644 index 0000000..58faa99 --- /dev/null +++ b/strlist.c @@ -0,0 +1,24 @@ +#include <assert.h> +#include <stdlib.h> +#include <string.h> + +#include "eprintf.h" +#include "strlist.h" + +void sl_append(struct strlist *sl, const char **list, int count) +{ + assert(sl != NULL); + + sl->list = erealloc(sl->list, (sl->count + count) * sizeof *sl->list); + memcpy(sl->list + sl->count, list, count * sizeof *list); + sl->count += count; +} + +void sl_free(struct strlist *sl) +{ + assert(sl != NULL); + + free(sl->list); + sl->list = NULL; + sl->count = 0; +} |