]> git.ipfire.org Git - thirdparty/systemd.git/commitdiff
systemctl: use strv_consume() where appropriate
authorLennart Poettering <lennart@poettering.net>
Wed, 6 Mar 2019 18:22:33 +0000 (19:22 +0100)
committerLennart Poettering <lennart@poettering.net>
Wed, 13 Mar 2019 16:38:43 +0000 (17:38 +0100)
src/systemctl/systemctl.c

index 03dea764cc6e5a858b46a3824f5c2b4d787e720b..a88dd839298f31bb6dfaf7bec06d92f886a88c93 100644 (file)
@@ -8023,9 +8023,8 @@ static int systemctl_parse_argv(int argc, char *argv[]) {
                                 }
 
                                 if (unit_type_from_string(type) >= 0) {
-                                        if (strv_push(&arg_types, type) < 0)
+                                        if (strv_consume(&arg_types, TAKE_PTR(type)) < 0)
                                                 return log_oom();
-                                        type = NULL;
                                         continue;
                                 }
 
@@ -8034,9 +8033,8 @@ static int systemctl_parse_argv(int argc, char *argv[]) {
                                  * in --types= too for compatibility
                                  * with old versions */
                                 if (unit_load_state_from_string(type) >= 0) {
-                                        if (strv_push(&arg_states, type) < 0)
+                                        if (strv_consume(&arg_states, TAKE_PTR(type)) < 0)
                                                 return log_oom();
-                                        type = NULL;
                                         continue;
                                 }