various: remove unnecessary check before sd_event_source_set_enabled()

sd_event_source_set_enabled() does the same check internally.
This commit is contained in:
Zbigniew Jędrzejewski-Szmek
2024-05-30 12:11:58 +02:00
parent acddb3cb79
commit a3ada90a37
6 changed files with 10 additions and 24 deletions
-3
View File
@@ -734,9 +734,6 @@ static int automount_start_expire(Automount *a) {
static void automount_stop_expire(Automount *a) {
assert(a);
if (!a->expire_event_source)
return;
(void) sd_event_source_set_enabled(a->expire_event_source, SD_EVENT_OFF);
}
-3
View File
@@ -1734,9 +1734,6 @@ static void socket_unwatch_fds(Socket *s) {
if (p->fd < 0)
continue;
if (!p->event_source)
continue;
r = sd_event_source_set_enabled(p->event_source, SD_EVENT_OFF);
if (r < 0)
log_unit_debug_errno(UNIT(s), r, "Failed to disable event source: %m");
+1 -3
View File
@@ -514,7 +514,6 @@ static void timer_enter_waiting(Timer *t, bool time_change) {
goto fail;
}
} else {
r = sd_event_add_time(
UNIT(t)->manager->event,
&t->monotonic_event_source,
@@ -529,8 +528,7 @@ static void timer_enter_waiting(Timer *t, bool time_change) {
(void) sd_event_source_set_description(t->monotonic_event_source, "timer-monotonic");
}
} else if (t->monotonic_event_source) {
} else {
r = sd_event_source_set_enabled(t->monotonic_event_source, SD_EVENT_OFF);
if (r < 0) {
log_unit_warning_errno(UNIT(t), r, "Failed to disable monotonic event source: %m");