diff options
Diffstat (limited to 'include')
-rw-r--r-- | include/util/strlist.h | 38 |
1 files changed, 38 insertions, 0 deletions
diff --git a/include/util/strlist.h b/include/util/strlist.h new file mode 100644 index 0000000..ace4e20 --- /dev/null +++ b/include/util/strlist.h @@ -0,0 +1,38 @@ +/* SPDX-License-Identifier: LGPL-3.0-or-later */ +/* + * strlist.h + * + * Copyright (C) 2023 David Oberhollenzer <goliath@infraroot.at> + */ +#ifndef UTIL_STRLIST_H +#define UTIL_STRLIST_H + +#include "sqfs/predef.h" +#include <string.h> + +typedef struct { + char **strings; + size_t count; + size_t capacity; +} strlist_t; + +static SQFS_INLINE void strlist_init(strlist_t *list) +{ + memset(list, 0, sizeof(*list)); +} + +#ifdef __cplusplus +extern "C" { +#endif + +SQFS_INTERNAL int strlist_init_copy(strlist_t *dst, const strlist_t *src); + +SQFS_INTERNAL void strlist_cleanup(strlist_t *list); + +SQFS_INTERNAL int strlist_append(strlist_t *list, const char *str); + +#ifdef __cplusplus +} +#endif + +#endif /* UTIL_STRLIST_H */ |