projects
/
platform
/
upstream
/
systemd.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
| inline |
side by side
(parent:
7c78959
)
strv: introduce strv_free_and_replace()
author
Lennart Poettering
<lennart@poettering.net>
Tue, 14 Nov 2017 22:21:57 +0000
(23:21 +0100)
committer
Lennart Poettering
<lennart@poettering.net>
Mon, 20 Nov 2017 15:43:15 +0000
(16:43 +0100)
it's like free_and_replace() but uses strv_free()
src/basic/strv.h
patch
|
blob
|
history
diff --git
a/src/basic/strv.h
b/src/basic/strv.h
index
c793b2c
..
0ed6b74
100644
(file)
--- 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; \
+ })