summaryrefslogtreecommitdiff
path: root/src/shared
diff options
context:
space:
mode:
authorLennart Poettering <lennart@poettering.net>2013-10-29 20:09:16 +0100
committerLennart Poettering <lennart@poettering.net>2013-10-29 20:09:16 +0100
commit897e7561a0f2b0e502fe57081b5d834876c49d7a (patch)
tree48c67c1e449d02f057452b6575452fccb1291c16 /src/shared
parent80ba3b84ddf40fccbc21184c2da41d97fe85633d (diff)
strv: introduce new STRV_MAKE and STRV_MAKE_EMPTY macros to create string arrays nicely on the fly
Diffstat (limited to 'src/shared')
-rw-r--r--src/shared/strv.h6
1 files changed, 5 insertions, 1 deletions
diff --git a/src/shared/strv.h b/src/shared/strv.h
index 737728a3c6..6ce21acdbd 100644
--- a/src/shared/strv.h
+++ b/src/shared/strv.h
@@ -86,12 +86,16 @@ bool strv_overlap(char **a, char **b) _pure_;
char **strv_sort(char **l);
void strv_print(char **l);
+#define STRV_MAKE(...) ((char**) ((const char*[]) { __VA_ARGS__, NULL }))
+
+#define STRV_MAKE_EMPTY ((char*[1]) { NULL })
+
#define strv_from_stdarg_alloca(first) \
({ \
char **_l; \
\
if (!first) \
- _l = ((char*[1]) { NULL }); \
+ _l = (char**) &first; \
else { \
unsigned _n; \
va_list _ap; \