summaryrefslogtreecommitdiff
path: root/src/core/slice.c
diff options
context:
space:
mode:
authorLennart Poettering <lennart@poettering.net>2021-04-26 18:14:07 +0200
committerLennart Poettering <lennart@poettering.net>2021-05-25 16:02:00 +0200
commit12f64221b0af5a9380a840ebeb897c2cd6cff955 (patch)
tree21a5e28261495ac0680bc46b680b5cc5fc71ce2f /src/core/slice.c
parent8ddba3f266a1deae3826a80e2d148909b7902020 (diff)
downloadsystemd-12f64221b0af5a9380a840ebeb897c2cd6cff955.tar.gz
core: add UNIT_GET_SLICE() helper
In a later commit we intend to move the slice logic to use proper dependencies instead of a "UnitRef" object. This preparatory commit drops direct use of the slice UnitRef object for a static inline function UNIT_GET_SLICE() that is both easier to grok, and allows us to easily replace its internal implementation later on.
Diffstat (limited to 'src/core/slice.c')
-rw-r--r--src/core/slice.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/src/core/slice.c b/src/core/slice.c
index cb94c97b24..5d836a11e6 100644
--- a/src/core/slice.c
+++ b/src/core/slice.c
@@ -53,7 +53,7 @@ static int slice_add_parent_slice(Slice *s) {
assert(s);
- if (UNIT_ISSET(u->slice))
+ if (UNIT_GET_SLICE(u))
return 0;
r = slice_build_parent_slice(u->id, &a);
@@ -101,7 +101,7 @@ static int slice_verify(Slice *s) {
if (r < 0)
return log_unit_error_errno(UNIT(s), r, "Failed to determine parent slice: %m");
- if (parent ? !unit_has_name(UNIT_DEREF(UNIT(s)->slice), parent) : UNIT_ISSET(UNIT(s)->slice))
+ if (parent ? !unit_has_name(UNIT_GET_SLICE(UNIT(s)), parent) : !!UNIT_GET_SLICE(UNIT(s)))
return log_unit_error_errno(UNIT(s), SYNTHETIC_ERRNO(ENOEXEC), "Located outside of parent slice. Refusing.");
return 0;