mirror of
https://github.com/systemd/systemd.git
synced 2024-10-31 07:51:21 +03:00
tree-wide: use sd_event_source_disable_unref() where we can
This commit is contained in:
parent
3777940ab2
commit
4f538d7b22
@ -109,7 +109,6 @@ StdoutStream* stdout_stream_free(StdoutStream *s) {
|
||||
return NULL;
|
||||
|
||||
if (s->server) {
|
||||
|
||||
if (s->context)
|
||||
client_context_release(s->server, s->context);
|
||||
|
||||
@ -123,11 +122,7 @@ StdoutStream* stdout_stream_free(StdoutStream *s) {
|
||||
(void) server_start_or_stop_idle_timer(s->server); /* Maybe we are idle now? */
|
||||
}
|
||||
|
||||
if (s->event_source) {
|
||||
sd_event_source_set_enabled(s->event_source, SD_EVENT_OFF);
|
||||
s->event_source = sd_event_source_unref(s->event_source);
|
||||
}
|
||||
|
||||
sd_event_source_disable_unref(s->event_source);
|
||||
safe_close(s->fd);
|
||||
free(s->label);
|
||||
free(s->identifier);
|
||||
|
@ -63,7 +63,6 @@
|
||||
|
||||
static int bus_poll(sd_bus *bus, bool need_more, uint64_t timeout_usec);
|
||||
static void bus_detach_io_events(sd_bus *b);
|
||||
static void bus_detach_inotify_event(sd_bus *b);
|
||||
|
||||
static thread_local sd_bus *default_system_bus = NULL;
|
||||
static thread_local sd_bus *default_user_bus = NULL;
|
||||
@ -140,7 +139,7 @@ void bus_close_io_fds(sd_bus *b) {
|
||||
void bus_close_inotify_fd(sd_bus *b) {
|
||||
assert(b);
|
||||
|
||||
bus_detach_inotify_event(b);
|
||||
b->inotify_event_source = sd_event_source_disable_unref(b->inotify_event_source);
|
||||
|
||||
b->inotify_fd = safe_close(b->inotify_fd);
|
||||
b->inotify_watches = mfree(b->inotify_watches);
|
||||
@ -3747,15 +3746,8 @@ int bus_attach_io_events(sd_bus *bus) {
|
||||
static void bus_detach_io_events(sd_bus *bus) {
|
||||
assert(bus);
|
||||
|
||||
if (bus->input_io_event_source) {
|
||||
sd_event_source_set_enabled(bus->input_io_event_source, SD_EVENT_OFF);
|
||||
bus->input_io_event_source = sd_event_source_unref(bus->input_io_event_source);
|
||||
}
|
||||
|
||||
if (bus->output_io_event_source) {
|
||||
sd_event_source_set_enabled(bus->output_io_event_source, SD_EVENT_OFF);
|
||||
bus->output_io_event_source = sd_event_source_unref(bus->output_io_event_source);
|
||||
}
|
||||
bus->input_io_event_source = sd_event_source_disable_unref(bus->input_io_event_source);
|
||||
bus->output_io_event_source = sd_event_source_disable_unref(bus->output_io_event_source);
|
||||
}
|
||||
|
||||
int bus_attach_inotify_event(sd_bus *bus) {
|
||||
@ -3787,15 +3779,6 @@ int bus_attach_inotify_event(sd_bus *bus) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
static void bus_detach_inotify_event(sd_bus *bus) {
|
||||
assert(bus);
|
||||
|
||||
if (bus->inotify_event_source) {
|
||||
sd_event_source_set_enabled(bus->inotify_event_source, SD_EVENT_OFF);
|
||||
bus->inotify_event_source = sd_event_source_unref(bus->inotify_event_source);
|
||||
}
|
||||
}
|
||||
|
||||
_public_ int sd_bus_attach_event(sd_bus *bus, sd_event *event, int priority) {
|
||||
int r;
|
||||
|
||||
@ -3860,17 +3843,9 @@ _public_ int sd_bus_detach_event(sd_bus *bus) {
|
||||
return 0;
|
||||
|
||||
bus_detach_io_events(bus);
|
||||
bus_detach_inotify_event(bus);
|
||||
|
||||
if (bus->time_event_source) {
|
||||
sd_event_source_set_enabled(bus->time_event_source, SD_EVENT_OFF);
|
||||
bus->time_event_source = sd_event_source_unref(bus->time_event_source);
|
||||
}
|
||||
|
||||
if (bus->quit_event_source) {
|
||||
sd_event_source_set_enabled(bus->quit_event_source, SD_EVENT_OFF);
|
||||
bus->quit_event_source = sd_event_source_unref(bus->quit_event_source);
|
||||
}
|
||||
bus->inotify_event_source = sd_event_source_disable_unref(bus->inotify_event_source);
|
||||
bus->time_event_source = sd_event_source_disable_unref(bus->time_event_source);
|
||||
bus->quit_event_source = sd_event_source_disable_unref(bus->quit_event_source);
|
||||
|
||||
bus->event = sd_event_unref(bus->event);
|
||||
return 1;
|
||||
|
@ -1285,11 +1285,7 @@ _public_ int sd_resolve_detach_event(sd_resolve *resolve) {
|
||||
if (!resolve->event)
|
||||
return 0;
|
||||
|
||||
if (resolve->event_source) {
|
||||
sd_event_source_set_enabled(resolve->event_source, SD_EVENT_OFF);
|
||||
resolve->event_source = sd_event_source_unref(resolve->event_source);
|
||||
}
|
||||
|
||||
resolve->event_source = sd_event_source_disable_unref(resolve->event_source);
|
||||
resolve->event = sd_event_unref(resolve->event);
|
||||
return 1;
|
||||
}
|
||||
|
@ -2365,14 +2365,8 @@ int varlink_server_detach_event(VarlinkServer *s) {
|
||||
|
||||
assert_return(s, -EINVAL);
|
||||
|
||||
LIST_FOREACH(sockets, ss, s->sockets) {
|
||||
|
||||
if (!ss->event_source)
|
||||
continue;
|
||||
|
||||
(void) sd_event_source_set_enabled(ss->event_source, SD_EVENT_OFF);
|
||||
ss->event_source = sd_event_source_unref(ss->event_source);
|
||||
}
|
||||
LIST_FOREACH(sockets, ss, s->sockets)
|
||||
ss->event_source = sd_event_source_disable_unref(ss->event_source);
|
||||
|
||||
sd_event_unref(s->event);
|
||||
return 0;
|
||||
|
Loading…
Reference in New Issue
Block a user