]> git.ipfire.org Git - thirdparty/systemd.git/commitdiff
basic/strv: drop strv_free_free 21530/head
authorZbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl>
Fri, 26 Nov 2021 09:02:44 +0000 (10:02 +0100)
committerZbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl>
Fri, 26 Nov 2021 13:58:44 +0000 (14:58 +0100)
I think the function name is confusing: we generally say "free_free" when
both keys and values are freed in a hash map, but here the type is an
array of strvs, so the name should be something like strv_array_free.

The function is unused since 143fadf369a18449464956206226761e49be1928 (2018),
let's just drop it.

src/basic/strv.c
src/basic/strv.h
src/test/test-strv.c

index 9aa9c740c36fce9143268a3f02c98c1bcb9d262f..2ba5a9483984a1cd306094a66499c3002c6aa9d9 100644 (file)
@@ -860,16 +860,6 @@ bool strv_fnmatch_full(char* const* patterns, const char *s, int flags, size_t *
         return false;
 }
 
-char*** strv_free_free(char ***l) {
-        if (!l)
-                return NULL;
-
-        for (char ***i = l; *i; i++)
-                strv_free(*i);
-
-        return mfree(l);
-}
-
 char** strv_skip(char **l, size_t n) {
 
         while (n > 0) {
index 238ac60622406b4bc5872cbfbf32de81ef11243b..092d40c84b085679b3d7ac6b147d39bfba46cc5a 100644 (file)
@@ -228,9 +228,6 @@ static inline bool strv_fnmatch_or_empty(char* const* patterns, const char *s, i
                strv_fnmatch_full(patterns, s, flags, NULL);
 }
 
-char*** strv_free_free(char ***l);
-DEFINE_TRIVIAL_CLEANUP_FUNC(char***, strv_free_free);
-
 char** strv_skip(char **l, size_t n);
 
 int strv_extend_n(char ***l, const char *value, size_t n);
index a025f34408ad41ea00ffdb433a80e9e6af7309ac..94581fc8320294d641e42da9304f846b4bf3df59 100644 (file)
@@ -917,17 +917,6 @@ TEST(strv_make_nulstr) {
         test_strv_make_nulstr_one(STRV_MAKE("foo", "bar", "quuux"));
 }
 
-TEST(strv_free_free) {
-        char ***t;
-
-        assert_se(t = new(char**, 3));
-        assert_se(t[0] = strv_new("a", "b"));
-        assert_se(t[1] = strv_new("c", "d", "e"));
-        t[2] = NULL;
-
-        t = strv_free_free(t);
-}
-
 TEST(foreach_string) {
         const char * const t[] = {
                 "foo",