Add macro for checking if some flags are set
This way we don't need to repeat the argument twice. I didn't replace all instances. I think it's better to leave out: - asserts - comparisons like x & y == x, which are mathematically equivalent, but here we aren't checking if flags are set, but if the argument fits in the flags.
This commit is contained in:
+1
-1
@@ -1303,7 +1303,7 @@ const char *unit_get_realized_cgroup_path(Unit *u, CGroupMask mask) {
|
||||
|
||||
if (u->cgroup_path &&
|
||||
u->cgroup_realized &&
|
||||
(u->cgroup_realized_mask & mask) == mask)
|
||||
FLAGS_SET(u->cgroup_realized_mask, mask))
|
||||
return u->cgroup_path;
|
||||
|
||||
u = UNIT_DEREF(u->slice);
|
||||
|
||||
+3
-3
@@ -1053,7 +1053,7 @@ static void print_unit_dependency_mask(FILE *f, const char *kind, UnitDependency
|
||||
if (mask == 0)
|
||||
break;
|
||||
|
||||
if ((mask & table[i].mask) == table[i].mask) {
|
||||
if (FLAGS_SET(mask, table[i].mask)) {
|
||||
if (*space)
|
||||
fputc(' ', f);
|
||||
else
|
||||
@@ -2695,8 +2695,8 @@ static int unit_add_dependency_hashmap(
|
||||
if (info.data) {
|
||||
/* Entry already exists. Add in our mask. */
|
||||
|
||||
if ((info.origin_mask & origin_mask) == info.origin_mask &&
|
||||
(info.destination_mask & destination_mask) == info.destination_mask)
|
||||
if (FLAGS_SET(origin_mask, info.origin_mask) &&
|
||||
FLAGS_SET(destination_mask, info.destination_mask))
|
||||
return 0; /* NOP */
|
||||
|
||||
info.origin_mask |= origin_mask;
|
||||
|
||||
Reference in New Issue
Block a user