basic/strv: drop flags argument from strv_fnmatch()
This commit is contained in:
parent
0ef84b80c5
commit
191a3f1634
|
@ -1162,9 +1162,9 @@ static int graph_one_property(
|
||||||
assert(prop);
|
assert(prop);
|
||||||
assert(color);
|
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;
|
return 0;
|
||||||
|
|
||||||
r = bus_get_unit_property_strv(bus, u->unit_path, prop, &units);
|
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) {
|
STRV_FOREACH(unit, units) {
|
||||||
bool match_patterns2;
|
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;
|
continue;
|
||||||
|
|
||||||
if (!strv_isempty(patterns) && !match_patterns && !match_patterns2)
|
if (!strv_isempty(patterns) && !match_patterns && !match_patterns2)
|
||||||
|
|
|
@ -178,14 +178,14 @@ char **strv_reverse(char **l);
|
||||||
char **strv_shell_escape(char **l, const char *bad);
|
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);
|
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) {
|
static inline bool strv_fnmatch(char* const* patterns, const char *s) {
|
||||||
return strv_fnmatch_full(patterns, s, flags, NULL);
|
return strv_fnmatch_full(patterns, s, 0, NULL);
|
||||||
}
|
}
|
||||||
|
|
||||||
static inline bool strv_fnmatch_or_empty(char* const* patterns, const char *s, int flags) {
|
static inline bool strv_fnmatch_or_empty(char* const* patterns, const char *s, int flags) {
|
||||||
assert(s);
|
assert(s);
|
||||||
return strv_isempty(patterns) ||
|
return strv_isempty(patterns) ||
|
||||||
strv_fnmatch(patterns, s, flags);
|
strv_fnmatch_full(patterns, s, flags, NULL);
|
||||||
}
|
}
|
||||||
|
|
||||||
char ***strv_free_free(char ***l);
|
char ***strv_free_free(char ***l);
|
||||||
|
|
|
@ -1875,7 +1875,7 @@ static int link_new_bound_by_list(Link *link) {
|
||||||
if (strv_isempty(carrier->network->bind_carrier))
|
if (strv_isempty(carrier->network->bind_carrier))
|
||||||
continue;
|
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);
|
r = link_put_carrier(link, carrier, &link->bound_by_links);
|
||||||
if (r < 0)
|
if (r < 0)
|
||||||
return r;
|
return r;
|
||||||
|
@ -1917,7 +1917,7 @@ static int link_new_bound_to_list(Link *link) {
|
||||||
m = link->manager;
|
m = link->manager;
|
||||||
|
|
||||||
HASHMAP_FOREACH (carrier, m->links, i) {
|
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);
|
r = link_put_carrier(link, carrier, &link->bound_to_links);
|
||||||
if (r < 0)
|
if (r < 0)
|
||||||
return r;
|
return r;
|
||||||
|
|
|
@ -29,7 +29,7 @@ static bool manager_ignore_link(Manager *m, Link *link) {
|
||||||
return true;
|
return true;
|
||||||
|
|
||||||
/* ignore interfaces we explicitly are asked to ignore */
|
/* 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) {
|
static int manager_link_is_online(Manager *m, Link *l, LinkOperationalState s) {
|
||||||
|
|
|
@ -928,7 +928,7 @@ static void test_strv_fnmatch(void) {
|
||||||
|
|
||||||
log_info("/* %s */", __func__);
|
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");
|
v = strv_new("xxx", "*\\*", "yyy");
|
||||||
assert_se(!strv_fnmatch_full(v, "\\", 0, NULL));
|
assert_se(!strv_fnmatch_full(v, "\\", 0, NULL));
|
||||||
|
|
Loading…
Reference in a new issue