mirror of
https://github.com/systemd/systemd
synced 2024-07-08 20:15:55 +00:00
core/unit: merge nested if statements, use else where appropriate
We already use `else if` for unit state checks above. Let's use that at one more place to make mutually exclusive cases more distinct.
This commit is contained in:
parent
f6f271f0db
commit
b984151e50
|
@ -2611,17 +2611,16 @@ void unit_notify(Unit *u, UnitActiveState os, UnitActiveState ns, bool reload_su
|
|||
* the bus queue, so that any job change signal queued will force out the unit change signal first. */
|
||||
unit_add_to_dbus_queue(u);
|
||||
|
||||
/* Update systemd-oomd on the property/state change */
|
||||
if (os != ns) {
|
||||
/* Always send an update if the unit is going into an inactive state so systemd-oomd knows to stop
|
||||
* monitoring.
|
||||
* Also send an update whenever the unit goes active; this is to handle a case where an override file
|
||||
* sets one of the ManagedOOM*= properties to "kill", then later removes it. systemd-oomd needs to
|
||||
* know to stop monitoring when the unit changes from "kill" -> "auto" on daemon-reload, but we don't
|
||||
* have the information on the property. Thus, indiscriminately send an update. */
|
||||
if (UNIT_IS_INACTIVE_OR_FAILED(ns) || UNIT_IS_ACTIVE_OR_RELOADING(ns))
|
||||
(void) manager_varlink_send_managed_oom_update(u);
|
||||
}
|
||||
/* Update systemd-oomd on the property/state change.
|
||||
*
|
||||
* Always send an update if the unit is going into an inactive state so systemd-oomd knows to
|
||||
* stop monitoring.
|
||||
* Also send an update whenever the unit goes active; this is to handle a case where an override file
|
||||
* sets one of the ManagedOOM*= properties to "kill", then later removes it. systemd-oomd needs to
|
||||
* know to stop monitoring when the unit changes from "kill" -> "auto" on daemon-reload, but we don't
|
||||
* have the information on the property. Thus, indiscriminately send an update. */
|
||||
if (os != ns && (UNIT_IS_INACTIVE_OR_FAILED(ns) || UNIT_IS_ACTIVE_OR_RELOADING(ns)))
|
||||
(void) manager_varlink_send_managed_oom_update(u);
|
||||
|
||||
/* Update timestamps for state changes */
|
||||
if (!MANAGER_IS_RELOADING(m)) {
|
||||
|
@ -2734,9 +2733,8 @@ void unit_notify(Unit *u, UnitActiveState os, UnitActiveState ns, bool reload_su
|
|||
|
||||
/* Maybe we can release some resources now? */
|
||||
unit_submit_to_release_resources_queue(u);
|
||||
}
|
||||
|
||||
if (UNIT_IS_ACTIVE_OR_RELOADING(ns)) {
|
||||
} else if (UNIT_IS_ACTIVE_OR_RELOADING(ns)) {
|
||||
/* Start uphold units regardless if going up was expected or not */
|
||||
check_uphold_dependencies(u);
|
||||
|
||||
|
|
Loading…
Reference in New Issue
Block a user