summaryrefslogtreecommitdiffstats
path: root/include/stringlist.h
blob: 3453e9a4f6ce548dc9d2da0824cc7456378c13a9 (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
#ifndef __STRING_H
#define __STRING_H

#include <linux/list.h>

struct string_list {
	struct list_head list;
	char str[0];
};

int string_list_add(struct string_list *sl, char *str);
void string_list_print_by_column(struct string_list *sl);

static inline void string_list_init(struct string_list *sl)
{
	INIT_LIST_HEAD(&sl->list);
}

static inline void string_list_free(struct string_list *sl)
{
	struct string_list *entry, *safe;

	list_for_each_entry_safe(entry, safe, &sl->list, list)
		free(entry);
}

#endif /* __STRING_H */