From: Lennart Poettering Date: Tue, 14 Nov 2017 22:21:57 +0000 (+0100) Subject: strv: introduce strv_free_and_replace() X-Git-Tag: v236~158^2~5 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=b302a50d852b33efe018cd7cd3d47799b1ec094b;p=thirdparty%2Fsystemd.git strv: introduce strv_free_and_replace() it's like free_and_replace() but uses strv_free() --- diff --git a/src/basic/strv.h b/src/basic/strv.h index c793b2cf514..0ed6b74330c 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; \ + })