summaryrefslogtreecommitdiff
path: root/src/shared/strv.c
diff options
context:
space:
mode:
authorTom Gundersen <teg@jklm.no>2014-12-17 01:08:56 +0100
committerTom Gundersen <teg@jklm.no>2014-12-17 01:09:16 +0100
commitdd9c7723fafc8b326188efa86efe00bcbe5abcfd (patch)
tree5009480faf68308a8fb769115158e1e11f0b2e1f /src/shared/strv.c
parent3542eac7f98e74ca106ac6df81b3b3cb158b35be (diff)
shared: strv - add strv_clear()
This frees the elements of the strv without freeing the strv itself.
Diffstat (limited to 'src/shared/strv.c')
-rw-r--r--src/shared/strv.c7
1 files changed, 6 insertions, 1 deletions
diff --git a/src/shared/strv.c b/src/shared/strv.c
index fdb658c0a3..f86dddaf81 100644
--- a/src/shared/strv.c
+++ b/src/shared/strv.c
@@ -69,7 +69,7 @@ char *strv_find_startswith(char **l, const char *name) {
return NULL;
}
-void strv_free(char **l) {
+void strv_clear(char **l) {
char **k;
if (!l)
@@ -78,6 +78,11 @@ void strv_free(char **l) {
for (k = l; *k; k++)
free(*k);
+ *l = NULL;
+}
+
+void strv_free(char **l) {
+ strv_clear(l);
free(l);
}