aboutsummaryrefslogtreecommitdiff
path: root/include/util/strlist.h
blob: ace4e20504365d29030fb1266d13333788ae17f5 (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
25
26
27
28
29
30
31
32
33
34
35
36
37
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 */