sd-event: split out enable and disable codepaths from sd_event_source_set_enabled()
authorLennart Poettering <lennart@poettering.net>
Fri, 23 Oct 2020 19:21:58 +0000 (21:21 +0200)
committerLennart Poettering <lennart@poettering.net>
Tue, 27 Oct 2020 13:01:36 +0000 (14:01 +0100)
commitddfde737b546c17e54182028153aa7f7e78804e3
tree1e373e5a9bf4d85106ebaa5f3c12b6d4137cdf1b
parente1951c16a8fbe5b0b9ecc08f4f835a806059d28f
sd-event: split out enable and disable codepaths from sd_event_source_set_enabled()

So far half of sd_event_source_set_enabled() was doing enabling, the
other half was doing disabling. Let's split that into two separate
calls.

(This also adds a new shortcut to sd_event_source_set_enabled(): if the
caller toggles between "ON" and "ONESHOT" we'll now shortcut this, since
the event source is already enabled in that case and shall remain
enabled.)

This heavily borrows and is inspired from Michal Sekletár's #17284
refactoring.
src/libsystemd/sd-event/sd-event.c