From: Zbigniew Jędrzejewski-Szmek Date: Mon, 7 Mar 2022 18:28:11 +0000 (+0100) Subject: tree-wide: use strv_contains() in more places X-Git-Tag: v251-rc1~112 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=d29cc4d6e1c04b89c3abf3fdb4bcad9f2715b451;p=thirdparty%2Fsystemd.git tree-wide: use strv_contains() in more places --- diff --git a/src/basic/strv.c b/src/basic/strv.c index 2ba5a948398..cf573a37838 100644 --- a/src/basic/strv.c +++ b/src/basic/strv.c @@ -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; diff --git a/src/core/service.c b/src/core/service.c index acf3df77da4..92485875f7a 100644 --- a/src/core/service.c +++ b/src/core/service.c @@ -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="); diff --git a/src/home/homectl-pkcs11.c b/src/home/homectl-pkcs11.c index 52cee9a1738..c146c62e58b 100644 --- a/src/home/homectl-pkcs11.c +++ b/src/home/homectl-pkcs11.c @@ -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); diff --git a/src/nspawn/nspawn.c b/src/nspawn/nspawn.c index 7fe061899cc..ff4ccde1f88 100644 --- a/src/nspawn/nspawn.c +++ b/src/nspawn/nspawn.c @@ -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"); diff --git a/src/shared/bus-print-properties.c b/src/shared/bus-print-properties.c index 4e401180e9a..737bbd3d36c 100644 --- a/src/shared/bus-print-properties.c +++ b/src/shared/bus-print-properties.c @@ -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) diff --git a/src/systemctl/systemctl-list-unit-files.c b/src/systemctl/systemctl-list-unit-files.c index 08f4bd7e2a2..552e85a06b7 100644 --- a/src/systemctl/systemctl-list-unit-files.c +++ b/src/systemctl/systemctl-list-unit-files.c @@ -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; diff --git a/src/systemctl/systemctl-util.c b/src/systemctl/systemctl-util.c index ae02af280e8..acf2e477d3a 100644 --- a/src/systemctl/systemctl-util.c +++ b/src/systemctl/systemctl-util.c @@ -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) diff --git a/src/sysusers/sysusers.c b/src/sysusers/sysusers.c index 07a65a2ebc1..4962bf72333 100644 --- a/src/sysusers/sysusers.c +++ b/src/sysusers/sysusers.c @@ -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)