]> git.ipfire.org Git - thirdparty/systemd.git/commitdiff
tree-wide: use strv_contains() in more places
authorZbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl>
Mon, 7 Mar 2022 18:28:11 +0000 (19:28 +0100)
committerLennart Poettering <lennart@poettering.net>
Fri, 18 Mar 2022 09:22:20 +0000 (10:22 +0100)
src/basic/strv.c
src/core/service.c
src/home/homectl-pkcs11.c
src/nspawn/nspawn.c
src/shared/bus-print-properties.c
src/systemctl/systemctl-list-unit-files.c
src/systemctl/systemctl-util.c
src/sysusers/sysusers.c

index 2ba5a9483984a1cd306094a66499c3002c6aa9d9..cf573a378383590ba6d864e5b9ade265e3534757 100644 (file)
@@ -610,7 +610,7 @@ bool strv_is_uniq(char * const *l) {
         char * const *i;
 
         STRV_FOREACH(i, l)
-                if (strv_find(i+1, *i))
+                if (strv_contains(i+1, *i))
                         return false;
 
         return true;
index acf3df77da4b0e5a258a3d2ba729ddc92cb49935..92485875f7a81704eca5a8486af844d4f095378f 100644 (file)
@@ -4251,7 +4251,7 @@ static void service_notify_message(
         /* Process FD store messages. Either FDSTOREREMOVE=1 for removal, or FDSTORE=1 for addition. In both cases,
          * process FDNAME= for picking the file descriptor name to use. Note that FDNAME= is required when removing
          * fds, but optional when pushing in new fds, for compatibility reasons. */
-        if (strv_find(tags, "FDSTOREREMOVE=1")) {
+        if (strv_contains(tags, "FDSTOREREMOVE=1")) {
                 const char *name;
 
                 name = strv_find_startswith(tags, "FDNAME=");
@@ -4260,7 +4260,7 @@ static void service_notify_message(
                 else
                         service_remove_fd_store(s, name);
 
-        } else if (strv_find(tags, "FDSTORE=1")) {
+        } else if (strv_contains(tags, "FDSTORE=1")) {
                 const char *name;
 
                 name = strv_find_startswith(tags, "FDNAME=");
index 52cee9a1738c264df4f55c804084610e32d21036..c146c62e58bc7f23232cc49e24f9935f6af93632 100644 (file)
@@ -114,7 +114,7 @@ int identity_add_token_pin(JsonVariant **v, const char *pin) {
         if (r < 0)
                 return log_error_errno(r, "Failed to convert PIN array: %m");
 
-        if (strv_find(pins, pin))
+        if (strv_contains(pins, pin))
                 return 0;
 
         r = strv_extend(&pins, pin);
index 7fe061899cc1918d79be3edb2f7089303d3946ba..ff4ccde1f88a52fc5f056511ecd9ca8d40571cb4 100644 (file)
@@ -4239,7 +4239,7 @@ static int nspawn_dispatch_notify_fd(sd_event_source *source, int fd, uint32_t r
         if (!tags)
                 return log_oom();
 
-        if (strv_find(tags, "READY=1")) {
+        if (strv_contains(tags, "READY=1")) {
                 r = sd_notify(false, "READY=1\n");
                 if (r < 0)
                         log_warning_errno(r, "Failed to send readiness notification, ignoring: %m");
index 4e401180e9a582a03dbe23fb940e73722e200275..737bbd3d36c1402e377885250fad4b39549f5426 100644 (file)
@@ -355,7 +355,7 @@ int bus_message_print_all_properties(
                 if (!name_with_equal)
                         return log_oom();
 
-                if (!filter || strv_find(filter, name) ||
+                if (!filter || strv_contains(filter, name) ||
                     (expected_value = strv_find_startswith(filter, name_with_equal))) {
                         r = sd_bus_message_peek_type(m, NULL, &contents);
                         if (r < 0)
index 08f4bd7e2a272c022a7fa9d85f10cf648022abad..552e85a06b71c3d190ed96cb8808e59f314179f7 100644 (file)
@@ -38,12 +38,12 @@ static bool output_show_unit_file(const UnitFileList *u, char **states, char **p
                 if (!dot)
                         return false;
 
-                if (!strv_find(arg_types, dot+1))
+                if (!strv_contains(arg_types, dot+1))
                         return false;
         }
 
         if (!strv_isempty(states) &&
-            !strv_find(states, unit_file_state_to_string(u->state)))
+            !strv_contains(states, unit_file_state_to_string(u->state)))
                 return false;
 
         return true;
index ae02af280e8b6deb0d7734fc388ebf696b9b76d5..acf2e477d3a9831b3d0955544817fab7d148667d 100644 (file)
@@ -783,7 +783,7 @@ bool output_show_unit(const UnitInfo *u, char **patterns) {
         if (!strv_fnmatch_or_empty(patterns, u->id, FNM_NOESCAPE))
                 return false;
 
-        if (arg_types && !strv_find(arg_types, unit_type_suffix(u->id)))
+        if (arg_types && !strv_contains(arg_types, unit_type_suffix(u->id)))
                 return false;
 
         if (arg_all)
index 07a65a2ebc14086e4e2b4321b61e283f34063af9..4962bf7233392d24a6fec4319f686452fba3f2a9 100644 (file)
@@ -319,7 +319,7 @@ static int putgrent_with_members(const struct group *gr, FILE *group) {
                         return -ENOMEM;
 
                 STRV_FOREACH(i, a) {
-                        if (strv_find(l, *i))
+                        if (strv_contains(l, *i))
                                 continue;
 
                         if (strv_extend(&l, *i) < 0)
@@ -364,7 +364,7 @@ static int putsgent_with_members(const struct sgrp *sg, FILE *gshadow) {
                         return -ENOMEM;
 
                 STRV_FOREACH(i, a) {
-                        if (strv_find(l, *i))
+                        if (strv_contains(l, *i))
                                 continue;
 
                         if (strv_extend(&l, *i) < 0)