summaryrefslogtreecommitdiff
path: root/src/core/slice.c
diff options
context:
space:
mode:
authorLennart Poettering <lennart@poettering.net>2015-11-11 20:42:39 +0100
committerLennart Poettering <lennart@poettering.net>2015-11-11 20:42:39 +0100
commit4c9ea260aeaff2e837f543e3c42d2e7102af1137 (patch)
treee1e6a1f6cbcb1a11c3eda17376e52fd401fcf8f9 /src/core/slice.c
parent45f06b3450174a9649a51a0b48fdbbbe98f2bb5d (diff)
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.
Diffstat (limited to 'src/core/slice.c')
-rw-r--r--src/core/slice.c12
1 files changed, 6 insertions, 6 deletions
diff --git a/src/core/slice.c b/src/core/slice.c
index 2aa3fbf8be..39dabae055 100644
--- a/src/core/slice.c
+++ b/src/core/slice.c
@@ -85,6 +85,9 @@ static int slice_add_default_dependencies(Slice *s) {
assert(s);
+ if (!UNIT(s)->default_dependencies)
+ return 0;
+
/* Make sure slices are unloaded on shutdown */
r = unit_add_two_dependencies_by_name(
UNIT(s),
@@ -96,7 +99,6 @@ static int slice_add_default_dependencies(Slice *s) {
return 0;
}
-
static int slice_verify(Slice *s) {
_cleanup_free_ char *parent = NULL;
int r;
@@ -144,11 +146,9 @@ static int slice_load(Unit *u) {
if (r < 0)
return r;
- if (u->default_dependencies) {
- r = slice_add_default_dependencies(s);
- if (r < 0)
- return r;
- }
+ r = slice_add_default_dependencies(s);
+ if (r < 0)
+ return r;
}
return slice_verify(s);