blob: 58faa99d35e57b7640b38418a71a0468c3dbe285 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
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;
}
|