tree-wide: use strv_contains() in more places
This commit is contained in:
committed by
Lennart Poettering
parent
d3e85c9c81
commit
d29cc4d6e1
+1
-1
@@ -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;
|
||||
|
||||
+2
-2
@@ -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=");
|
||||
|
||||
@@ -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);
|
||||
|
||||
+1
-1
@@ -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");
|
||||
|
||||
@@ -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)
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -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)
|
||||
|
||||
@@ -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)
|
||||
|
||||
Reference in New Issue
Block a user