summaryrefslogtreecommitdiff
path: root/src/basic/strv.h
diff options
context:
space:
mode:
authorLennart Poettering <lennart@poettering.net>2017-11-14 23:21:57 +0100
committerLennart Poettering <lennart@poettering.net>2017-11-20 16:43:15 +0100
commitb302a50d852b33efe018cd7cd3d47799b1ec094b (patch)
treee5f1a7c12f226d6776f76ec396fa3b97443737f5 /src/basic/strv.h
parent7c78959fc24079c3174835e1b42e4870b6835ec7 (diff)
downloadsystemd-b302a50d852b33efe018cd7cd3d47799b1ec094b.tar.gz
strv: introduce strv_free_and_replace()
it's like free_and_replace() but uses strv_free()
Diffstat (limited to 'src/basic/strv.h')
-rw-r--r--src/basic/strv.h8
1 files changed, 8 insertions, 0 deletions
diff --git a/src/basic/strv.h b/src/basic/strv.h
index c793b2cf51..0ed6b74330 100644
--- a/src/basic/strv.h
+++ b/src/basic/strv.h
@@ -181,3 +181,11 @@ char **strv_skip(char **l, size_t n);
int strv_extend_n(char ***l, const char *value, size_t n);
int fputstrv(FILE *f, char **l, const char *separator, bool *space);
+
+#define strv_free_and_replace(a, b) \
+ ({ \
+ strv_free(a); \
+ (a) = (b); \
+ (b) = NULL; \
+ 0; \
+ })