core: simplify things a bit by checking default_dependencies boolean in callee, not caller

It's nicer to hide the check away in the various
xyz_add_default_dependencies() calls, rather than making it explicit in
the caller, and thus require deeper nesing.
This commit is contained in:
Lennart Poettering
2015-11-11 20:42:39 +01:00
parent 45f06b3450
commit 4c9ea260ae
8 changed files with 51 additions and 47 deletions
+6 -5
View File
@@ -102,6 +102,9 @@ static int timer_add_default_dependencies(Timer *t) {
assert(t);
if (!UNIT(t)->default_dependencies)
return 0;
r = unit_add_dependency_by_name(UNIT(t), UNIT_BEFORE, SPECIAL_TIMERS_TARGET, NULL, true);
if (r < 0)
return r;
@@ -192,11 +195,9 @@ static int timer_load(Unit *u) {
if (r < 0)
return r;
if (u->default_dependencies) {
r = timer_add_default_dependencies(t);
if (r < 0)
return r;
}
r = timer_add_default_dependencies(t);
if (r < 0)
return r;
}
return timer_verify(t);