chiark
/
gitweb
/
~ianmdlvl
/
elogind.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
remove unused includes
[elogind.git]
/
src
/
analyze
/
analyze.c
diff --git
a/src/analyze/analyze.c
b/src/analyze/analyze.c
index 46a97eb8e7f9682e4c518d425d27c6a8ef5a9f1f..7abe969bef8006175ea7e0ef9ec2799439738da1 100644
(file)
--- a/
src/analyze/analyze.c
+++ b/
src/analyze/analyze.c
@@
-24,18
+24,14
@@
#include <stdlib.h>
#include <getopt.h>
#include <locale.h>
#include <stdlib.h>
#include <getopt.h>
#include <locale.h>
-#include <sys/utsname.h>
-#include <fnmatch.h>
#include "sd-bus.h"
#include "bus-util.h"
#include "bus-error.h"
#include "sd-bus.h"
#include "bus-util.h"
#include "bus-error.h"
-#include "install.h"
#include "log.h"
#include "build.h"
#include "util.h"
#include "strxcpyx.h"
#include "log.h"
#include "build.h"
#include "util.h"
#include "strxcpyx.h"
-#include "fileio.h"
#include "strv.h"
#include "unit-name.h"
#include "special.h"
#include "strv.h"
#include "unit-name.h"
#include "special.h"
@@
-975,56
+971,35
@@
static int graph_one_property(sd_bus *bus, const UnitInfo *u, const char* prop,
_cleanup_strv_free_ char **units = NULL;
char **unit;
int r;
_cleanup_strv_free_ char **units = NULL;
char **unit;
int r;
+ bool match_patterns;
assert(u);
assert(prop);
assert(color);
assert(u);
assert(prop);
assert(color);
+ match_patterns = strv_fnmatch(patterns, u->id, 0);
+
+ if (!strv_isempty(arg_dot_from_patterns) &&
+ !match_patterns &&
+ !strv_fnmatch(arg_dot_from_patterns, u->id, 0))
+ return 0;
+
r = bus_get_unit_property_strv(bus, u->unit_path, prop, &units);
if (r < 0)
return r;
STRV_FOREACH(unit, units) {
r = bus_get_unit_property_strv(bus, u->unit_path, prop, &units);
if (r < 0)
return r;
STRV_FOREACH(unit, units) {
- char **p;
- bool match_found;
-
- if (!strv_isempty(arg_dot_from_patterns)) {
- match_found = false;
-
- STRV_FOREACH(p, arg_dot_from_patterns)
- if (fnmatch(*p, u->id, 0) == 0) {
- match_found = true;
- break;
- }
-
- if (!match_found)
- continue;
- }
+ bool match_patterns2;
- if (!strv_isempty(arg_dot_to_patterns)) {
- match_found = false;
+ match_patterns2 = strv_fnmatch(patterns, *unit, 0);
- STRV_FOREACH(p, arg_dot_to_patterns)
- if (fnmatch(*p, *unit, 0) == 0) {
- match_found = true;
- break;
- }
-
- if (!match_found)
- continue;
- }
-
- if (!strv_isempty(patterns)) {
- match_found = false;
+ if (!strv_isempty(arg_dot_to_patterns) &&
+ !match_patterns2 &&
+ !strv_fnmatch(arg_dot_to_patterns, *unit, 0))
+ continue;
- STRV_FOREACH(p, patterns)
- if (fnmatch(*p, u->id, 0) == 0 || fnmatch(*p, *unit, 0) == 0) {
- match_found = true;
- break;
- }
- if (!match_found)
- continue;
- }
+ if (!strv_isempty(patterns) && !match_patterns && !match_patterns2)
+ continue;
printf("\t\"%s\"->\"%s\" [color=\"%s\"];\n", u->id, *unit, color);
}
printf("\t\"%s\"->\"%s\" [color=\"%s\"];\n", u->id, *unit, color);
}