summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/basic/strv.c9
-rw-r--r--src/basic/strv.h2
-rw-r--r--src/libsystemd/sd-hwdb/hwdb-util.c6
3 files changed, 5 insertions, 12 deletions
diff --git a/src/basic/strv.c b/src/basic/strv.c
index 74d20a9a95..096cb4e5d4 100644
--- a/src/basic/strv.c
+++ b/src/basic/strv.c
@@ -57,20 +57,15 @@ char *strv_find_startswith(char * const *l, const char *name) {
return NULL;
}
-void strv_clear(char **l) {
+char **strv_free(char **l) {
char **k;
if (!l)
- return;
+ return NULL;
for (k = l; *k; k++)
free(*k);
- *l = NULL;
-}
-
-char **strv_free(char **l) {
- strv_clear(l);
return mfree(l);
}
diff --git a/src/basic/strv.h b/src/basic/strv.h
index 85a49ab5c3..e7c2b1a604 100644
--- a/src/basic/strv.h
+++ b/src/basic/strv.h
@@ -25,8 +25,6 @@ char **strv_free_erase(char **l);
DEFINE_TRIVIAL_CLEANUP_FUNC(char**, strv_free_erase);
#define _cleanup_strv_free_erase_ _cleanup_(strv_free_erasep)
-void strv_clear(char **l);
-
char **strv_copy(char * const *l);
size_t strv_length(char * const *l) _pure_;
diff --git a/src/libsystemd/sd-hwdb/hwdb-util.c b/src/libsystemd/sd-hwdb/hwdb-util.c
index c83575c7c8..1a2da9c79b 100644
--- a/src/libsystemd/sd-hwdb/hwdb-util.c
+++ b/src/libsystemd/sd-hwdb/hwdb-util.c
@@ -543,7 +543,7 @@ static int import_file(struct trie *trie, const char *filename, uint16_t file_pr
"Property expected, ignoring record with no properties");
r = -EINVAL;
state = HW_NONE;
- strv_clear(match_list);
+ match_list = strv_free(match_list);
break;
}
@@ -571,7 +571,7 @@ static int import_file(struct trie *trie, const char *filename, uint16_t file_pr
if (len == 0) {
/* end of record */
state = HW_NONE;
- strv_clear(match_list);
+ match_list = strv_free(match_list);
break;
}
@@ -580,7 +580,7 @@ static int import_file(struct trie *trie, const char *filename, uint16_t file_pr
"Property or empty line expected, got \"%s\", ignoring record", line);
r = -EINVAL;
state = HW_NONE;
- strv_clear(match_list);
+ match_list = strv_free(match_list);
break;
}