basic/strv: drop flags argument from strv_fnmatch()

This commit is contained in:
Zbigniew Jędrzejewski-Szmek 2020-01-12 12:26:26 +01:00
parent 0ef84b80c5
commit 191a3f1634
5 changed files with 11 additions and 11 deletions

View File

@ -1162,9 +1162,9 @@ static int graph_one_property(
assert(prop);
assert(color);
match_patterns = strv_fnmatch(patterns, u->id, 0);
match_patterns = strv_fnmatch(patterns, u->id);
if (!strv_isempty(from_patterns) && !match_patterns && !strv_fnmatch(from_patterns, u->id, 0))
if (!strv_isempty(from_patterns) && !match_patterns && !strv_fnmatch(from_patterns, u->id))
return 0;
r = bus_get_unit_property_strv(bus, u->unit_path, prop, &units);
@ -1174,9 +1174,9 @@ static int graph_one_property(
STRV_FOREACH(unit, units) {
bool match_patterns2;
match_patterns2 = strv_fnmatch(patterns, *unit, 0);
match_patterns2 = strv_fnmatch(patterns, *unit);
if (!strv_isempty(to_patterns) && !match_patterns2 && !strv_fnmatch(to_patterns, *unit, 0))
if (!strv_isempty(to_patterns) && !match_patterns2 && !strv_fnmatch(to_patterns, *unit))
continue;
if (!strv_isempty(patterns) && !match_patterns && !match_patterns2)

View File

@ -178,14 +178,14 @@ char **strv_reverse(char **l);
char **strv_shell_escape(char **l, const char *bad);
bool strv_fnmatch_full(char* const* patterns, const char *s, int flags, size_t *matched_pos);
static inline bool strv_fnmatch(char* const* patterns, const char *s, int flags) {
return strv_fnmatch_full(patterns, s, flags, NULL);
static inline bool strv_fnmatch(char* const* patterns, const char *s) {
return strv_fnmatch_full(patterns, s, 0, NULL);
}
static inline bool strv_fnmatch_or_empty(char* const* patterns, const char *s, int flags) {
assert(s);
return strv_isempty(patterns) ||
strv_fnmatch(patterns, s, flags);
strv_fnmatch_full(patterns, s, flags, NULL);
}
char ***strv_free_free(char ***l);

View File

@ -1875,7 +1875,7 @@ static int link_new_bound_by_list(Link *link) {
if (strv_isempty(carrier->network->bind_carrier))
continue;
if (strv_fnmatch(carrier->network->bind_carrier, link->ifname, 0)) {
if (strv_fnmatch(carrier->network->bind_carrier, link->ifname)) {
r = link_put_carrier(link, carrier, &link->bound_by_links);
if (r < 0)
return r;
@ -1917,7 +1917,7 @@ static int link_new_bound_to_list(Link *link) {
m = link->manager;
HASHMAP_FOREACH (carrier, m->links, i) {
if (strv_fnmatch(link->network->bind_carrier, carrier->ifname, 0)) {
if (strv_fnmatch(link->network->bind_carrier, carrier->ifname)) {
r = link_put_carrier(link, carrier, &link->bound_to_links);
if (r < 0)
return r;

View File

@ -29,7 +29,7 @@ static bool manager_ignore_link(Manager *m, Link *link) {
return true;
/* ignore interfaces we explicitly are asked to ignore */
return strv_fnmatch(m->ignore, link->ifname, 0);
return strv_fnmatch(m->ignore, link->ifname);
}
static int manager_link_is_online(Manager *m, Link *l, LinkOperationalState s) {

View File

@ -928,7 +928,7 @@ static void test_strv_fnmatch(void) {
log_info("/* %s */", __func__);
assert_se(!strv_fnmatch(STRV_MAKE_EMPTY, "a", 0));
assert_se(!strv_fnmatch(STRV_MAKE_EMPTY, "a"));
v = strv_new("xxx", "*\\*", "yyy");
assert_se(!strv_fnmatch_full(v, "\\", 0, NULL));