]> git.ipfire.org Git - thirdparty/systemd.git/commitdiff
busctl: use set_ensure_consume()
authorYu Watanabe <watanabe.yu+github@gmail.com>
Sun, 10 Oct 2021 10:10:56 +0000 (19:10 +0900)
committerYu Watanabe <watanabe.yu+github@gmail.com>
Sun, 10 Oct 2021 10:10:56 +0000 (19:10 +0900)
src/busctl/busctl.c

index 27210e93895093aa1608ddc1e581b38c6fdf5811..30a86234d92ac51cb99a875d8f5d24b533514ef1 100644 (file)
@@ -464,14 +464,6 @@ static int tree_one(sd_bus *bus, const char *service) {
         if (r < 0)
                 return log_oom();
 
-        done = set_new(&string_hash_ops_free);
-        if (!done)
-                return log_oom();
-
-        failed = set_new(&string_hash_ops_free);
-        if (!failed)
-                return log_oom();
-
         for (;;) {
                 _cleanup_free_ char *p = NULL;
                 int q;
@@ -488,7 +480,7 @@ static int tree_one(sd_bus *bus, const char *service) {
                 if (q < 0 && r >= 0)
                         r = q;
 
-                q = set_consume(q < 0 ? failed : done, TAKE_PTR(p));
+                q = set_ensure_consume(q < 0 ? &failed : &done, &string_hash_ops_free, TAKE_PTR(p));
                 assert(q != 0);
                 if (q < 0)
                         return log_oom();