cgroup-util: check unified_cache before invoking streq()
Just a minor optimization.
This commit is contained in:
parent
ecc0eab247
commit
fc9ae7178e
|
@ -2340,10 +2340,13 @@ bool cg_unified(const char *controller) {
|
||||||
|
|
||||||
assert(cg_update_unified() >= 0);
|
assert(cg_update_unified() >= 0);
|
||||||
|
|
||||||
if (streq_ptr(controller, SYSTEMD_CGROUP_CONTROLLER))
|
if (unified_cache == CGROUP_UNIFIED_NONE)
|
||||||
return unified_cache >= CGROUP_UNIFIED_SYSTEMD;
|
return false;
|
||||||
else
|
|
||||||
return unified_cache >= CGROUP_UNIFIED_ALL;
|
if (unified_cache >= CGROUP_UNIFIED_ALL)
|
||||||
|
return true;
|
||||||
|
|
||||||
|
return streq_ptr(controller, SYSTEMD_CGROUP_CONTROLLER);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool cg_all_unified(void) {
|
bool cg_all_unified(void) {
|
||||||
|
|
Loading…
Reference in a new issue