summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorZbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl>2015-02-16 14:04:36 -0500
committerZbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl>2015-02-16 14:04:36 -0500
commit2404701e679904979751816930101511d8ec5d49 (patch)
tree618719c0296c0362978d5f8f2f662a9ef103fad7
parentd49dc8127676358e706663f3603265942d2507aa (diff)
downloadsystemd-2404701e679904979751816930101511d8ec5d49.tar.gz
Transpose args in strv_fnmatch() to be more oo
-rw-r--r--src/analyze/analyze.c8
-rw-r--r--src/libsystemd-network/network-internal.c8
-rw-r--r--src/shared/strv.c2
-rw-r--r--src/shared/strv.h6
-rw-r--r--src/systemctl/systemctl.c8
5 files changed, 16 insertions, 16 deletions
diff --git a/src/analyze/analyze.c b/src/analyze/analyze.c
index 1e2a6bbf25..591b4ab14e 100644
--- a/src/analyze/analyze.c
+++ b/src/analyze/analyze.c
@@ -980,11 +980,11 @@ static int graph_one_property(sd_bus *bus, const UnitInfo *u, const char* prop,
assert(prop);
assert(color);
- match_patterns = strv_fnmatch(u->id, patterns, 0);
+ match_patterns = strv_fnmatch(patterns, u->id, 0);
if (!strv_isempty(arg_dot_from_patterns) &&
!match_patterns &&
- !strv_fnmatch(u->id, arg_dot_from_patterns, 0))
+ !strv_fnmatch(arg_dot_from_patterns, u->id, 0))
return 0;
r = bus_get_unit_property_strv(bus, u->unit_path, prop, &units);
@@ -994,11 +994,11 @@ static int graph_one_property(sd_bus *bus, const UnitInfo *u, const char* prop,
STRV_FOREACH(unit, units) {
bool match_patterns2;
- match_patterns2 = strv_fnmatch(*unit, patterns, 0);
+ match_patterns2 = strv_fnmatch(patterns, *unit, 0);
if (!strv_isempty(arg_dot_to_patterns) &&
!match_patterns2 &&
- !strv_fnmatch(*unit, arg_dot_to_patterns, 0))
+ !strv_fnmatch(arg_dot_to_patterns, *unit, 0))
continue;
if (!strv_isempty(patterns) && !match_patterns && !match_patterns2)
diff --git a/src/libsystemd-network/network-internal.c b/src/libsystemd-network/network-internal.c
index 81f90aa389..b8e4e21716 100644
--- a/src/libsystemd-network/network-internal.c
+++ b/src/libsystemd-network/network-internal.c
@@ -113,19 +113,19 @@ bool net_match_config(const struct ether_addr *match_mac,
return false;
if (!strv_isempty(match_paths) &&
- (!dev_path || !strv_fnmatch(dev_path, match_paths, 0)))
+ (!dev_path || !strv_fnmatch(match_paths, dev_path, 0)))
return false;
if (!strv_isempty(match_drivers) &&
- (!dev_driver || !strv_fnmatch(dev_driver, match_drivers, 0)))
+ (!dev_driver || !strv_fnmatch(match_drivers, dev_driver, 0)))
return false;
if (!strv_isempty(match_types) &&
- (!dev_type || !strv_fnmatch_or_empty(dev_type, match_types, 0)))
+ (!dev_type || !strv_fnmatch_or_empty(match_types, dev_type, 0)))
return false;
if (!strv_isempty(match_names) &&
- (!dev_name || !strv_fnmatch_or_empty(dev_name, match_names, 0)))
+ (!dev_name || !strv_fnmatch_or_empty(match_names, dev_name, 0)))
return false;
return true;
diff --git a/src/shared/strv.c b/src/shared/strv.c
index 2268bf61db..e27ac68151 100644
--- a/src/shared/strv.c
+++ b/src/shared/strv.c
@@ -693,7 +693,7 @@ char **strv_reverse(char **l) {
return l;
}
-bool strv_fnmatch(const char *s, char* const* patterns, int flags) {
+bool strv_fnmatch(char* const* patterns, const char *s, int flags) {
char* const* p;
STRV_FOREACH(p, patterns)
diff --git a/src/shared/strv.h b/src/shared/strv.h
index a899395ba4..518c4c2aa8 100644
--- a/src/shared/strv.h
+++ b/src/shared/strv.h
@@ -146,10 +146,10 @@ void strv_print(char **l);
char **strv_reverse(char **l);
-bool strv_fnmatch(const char *s, char* const* patterns, int flags);
+bool strv_fnmatch(char* const* patterns, const char *s, int flags);
-static inline bool strv_fnmatch_or_empty(const char *s, char* const* patterns, int flags) {
+static inline bool strv_fnmatch_or_empty(char* const* patterns, const char *s, int flags) {
assert(s);
return strv_isempty(patterns) ||
- strv_fnmatch(s, patterns, flags);
+ strv_fnmatch(patterns, s, flags);
}
diff --git a/src/systemctl/systemctl.c b/src/systemctl/systemctl.c
index 66bfd0eab7..21cb898b9a 100644
--- a/src/systemctl/systemctl.c
+++ b/src/systemctl/systemctl.c
@@ -310,7 +310,7 @@ static int compare_unit_info(const void *a, const void *b) {
}
static bool output_show_unit(const UnitInfo *u, char **patterns) {
- if (!strv_fnmatch_or_empty(u->id, patterns, FNM_NOESCAPE))
+ if (!strv_fnmatch_or_empty(patterns, u->id, FNM_NOESCAPE))
return false;
if (arg_types) {
@@ -1247,7 +1247,7 @@ static int compare_unit_file_list(const void *a, const void *b) {
}
static bool output_show_unit_file(const UnitFileList *u, char **patterns) {
- if (!strv_fnmatch_or_empty(basename(u->path), patterns, FNM_NOESCAPE))
+ if (!strv_fnmatch_or_empty(patterns, basename(u->path), FNM_NOESCAPE))
return false;
if (!strv_isempty(arg_types)) {
@@ -1720,7 +1720,7 @@ static int get_machine_properties(sd_bus *bus, struct machine_info *mi) {
}
static bool output_show_machine(const char *name, char **patterns) {
- return strv_fnmatch_or_empty(name, patterns, FNM_NOESCAPE);
+ return strv_fnmatch_or_empty(patterns, name, FNM_NOESCAPE);
}
static int get_machine_list(
@@ -2073,7 +2073,7 @@ static void output_jobs_list(const struct job_info* jobs, unsigned n, bool skipp
}
static bool output_show_job(struct job_info *job, char **patterns) {
- return strv_fnmatch_or_empty(job->name, patterns, FNM_NOESCAPE);
+ return strv_fnmatch_or_empty(patterns, job->name, FNM_NOESCAPE);
}
static int list_jobs(sd_bus *bus, char **args) {