1
1
mirror of https://github.com/systemd/systemd-stable.git synced 2024-12-22 13:33:56 +03:00

Use sd_event_source_disable_unref()

This commit is contained in:
Zbigniew Jędrzejewski-Szmek 2019-05-08 14:47:32 +02:00
parent aa7585fd8e
commit 1d3fe304fd
5 changed files with 44 additions and 28 deletions

View File

@ -0,0 +1,36 @@
@@
expression p;
@@
- if (p) {
- (void) sd_event_source_set_enabled(p, SD_EVENT_OFF);
- p = sd_event_source_unref(p);
- }
+ p = sd_event_source_disable_unref(p);
@@
expression p;
@@
- if (p) {
- sd_event_source_set_enabled(p, SD_EVENT_OFF);
- sd_event_source_unref(p);
- }
+ sd_event_source_disable_unref(p);
@@
expression p;
@@
- if (p) {
- (void) sd_event_source_set_enabled(p, SD_EVENT_OFF);
- sd_event_source_unref(p);
- }
+ sd_event_source_disable_unref(p);
@@
expression p;
@@
- (void) sd_event_source_set_enabled(p, SD_EVENT_OFF);
- sd_event_source_unref(p);
+ sd_event_source_disable_unref(p);
@@
expression p;
@@
- sd_event_source_set_enabled(p, SD_EVENT_OFF);
- sd_event_source_unref(p);
+ sd_event_source_disable_unref(p);

View File

@ -320,10 +320,7 @@ static void service_fd_store_unlink(ServiceFDStore *fs) {
fs->service->n_fd_store--;
}
if (fs->event_source) {
sd_event_source_set_enabled(fs->event_source, SD_EVENT_OFF);
sd_event_source_unref(fs->event_source);
}
sd_event_source_disable_unref(fs->event_source);
free(fs->fdname);
safe_close(fs->fd);

View File

@ -70,8 +70,7 @@ static int curl_glue_socket_callback(CURLM *curl, curl_socket_t s, int action, v
fd = sd_event_source_get_io_fd(io);
assert(fd >= 0);
sd_event_source_set_enabled(io, SD_EVENT_OFF);
sd_event_source_unref(io);
sd_event_source_disable_unref(io);
hashmap_remove(g->ios, FD_TO_PTR(s));
hashmap_remove(g->translate_fds, FD_TO_PTR(fd));

View File

@ -357,8 +357,7 @@ JournalFile* journal_file_close(JournalFile *f) {
if (sd_event_source_get_enabled(f->post_change_timer, NULL) > 0)
journal_file_post_change(f);
(void) sd_event_source_set_enabled(f->post_change_timer, SD_EVENT_OFF);
sd_event_source_unref(f->post_change_timer);
sd_event_source_disable_unref(f->post_change_timer);
}
journal_file_set_offline(f, true);

View File

@ -335,25 +335,13 @@ int varlink_connect_fd(Varlink **ret, int fd) {
static void varlink_detach_event_sources(Varlink *v) {
assert(v);
if (v->io_event_source) {
(void) sd_event_source_set_enabled(v->io_event_source, SD_EVENT_OFF);
v->io_event_source = sd_event_source_unref(v->io_event_source);
}
v->io_event_source = sd_event_source_disable_unref(v->io_event_source);
if (v->time_event_source) {
(void) sd_event_source_set_enabled(v->time_event_source, SD_EVENT_OFF);
v->time_event_source = sd_event_source_unref(v->time_event_source);
}
v->time_event_source = sd_event_source_disable_unref(v->time_event_source);
if (v->quit_event_source) {
(void) sd_event_source_set_enabled(v->quit_event_source, SD_EVENT_OFF);
v->quit_event_source = sd_event_source_unref(v->quit_event_source);
}
v->quit_event_source = sd_event_source_disable_unref(v->quit_event_source);
if (v->defer_event_source) {
(void) sd_event_source_set_enabled(v->defer_event_source, SD_EVENT_OFF);
v->defer_event_source = sd_event_source_unref(v->defer_event_source);
}
v->defer_event_source = sd_event_source_disable_unref(v->defer_event_source);
}
static void varlink_clear(Varlink *v) {
@ -2203,10 +2191,7 @@ static VarlinkServerSocket* varlink_server_socket_destroy(VarlinkServerSocket *s
if (ss->server)
LIST_REMOVE(sockets, ss->server->sockets, ss);
if (ss->event_source) {
(void) sd_event_source_set_enabled(ss->event_source, SD_EVENT_OFF);
sd_event_source_unref(ss->event_source);
}
sd_event_source_disable_unref(ss->event_source);
free(ss->address);
safe_close(ss->fd);