diff options
author | Lennart Poettering <lennart@poettering.net> | 2015-11-11 20:42:39 +0100 |
---|---|---|
committer | Lennart Poettering <lennart@poettering.net> | 2015-11-11 20:42:39 +0100 |
commit | 4c9ea260aeaff2e837f543e3c42d2e7102af1137 (patch) | |
tree | e1e6a1f6cbcb1a11c3eda17376e52fd401fcf8f9 /src/core/socket.c | |
parent | 45f06b3450174a9649a51a0b48fdbbbe98f2bb5d (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/socket.c')
-rw-r--r-- | src/core/socket.c | 11 |
1 files changed, 6 insertions, 5 deletions
diff --git a/src/core/socket.c b/src/core/socket.c index c73ee78b13..43d4ec5dca 100644 --- a/src/core/socket.c +++ b/src/core/socket.c @@ -296,6 +296,9 @@ static int socket_add_default_dependencies(Socket *s) { int r; assert(s); + if (!UNIT(s)->default_dependencies) + return 0; + r = unit_add_dependency_by_name(UNIT(s), UNIT_BEFORE, SPECIAL_SOCKETS_TARGET, NULL, true); if (r < 0) return r; @@ -365,11 +368,9 @@ static int socket_add_extras(Socket *s) { return r; } - if (u->default_dependencies) { - r = socket_add_default_dependencies(s); - if (r < 0) - return r; - } + r = socket_add_default_dependencies(s); + if (r < 0) + return r; return 0; } |