diff options
| author | Lennart Poettering <lennart@poettering.net> | 2017-11-14 23:21:57 +0100 |
|---|---|---|
| committer | Lennart Poettering <lennart@poettering.net> | 2017-11-20 16:43:15 +0100 |
| commit | b302a50d852b33efe018cd7cd3d47799b1ec094b (patch) | |
| tree | e5f1a7c12f226d6776f76ec396fa3b97443737f5 /src/basic/strv.h | |
| parent | 7c78959fc24079c3174835e1b42e4870b6835ec7 (diff) | |
| download | systemd-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.h | 8 |
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; \ + }) |
