From ca5d90d4d99dc1a6196459b5fc54f603099969a9 Mon Sep 17 00:00:00 2001 From: Zbigniew Jędrzejewski-Szmek Date: Fri, 16 Nov 2018 08:51:17 +0100 Subject: journal-file: get rid of a helper variable It doesn't really save much in code length. Having the event source named explicitly makes it easier to understand the code at a glance. --- src/journal/journal-file.c | 11 ++++------- 1 file changed, 4 insertions(+), 7 deletions(-) (limited to 'src/journal/journal-file.c') diff --git a/src/journal/journal-file.c b/src/journal/journal-file.c index 14da087f24..ea1e450344 100644 --- a/src/journal/journal-file.c +++ b/src/journal/journal-file.c @@ -1869,16 +1869,13 @@ static int post_change_thunk(sd_event_source *timer, uint64_t usec, void *userda } static void schedule_post_change(JournalFile *f) { - sd_event_source *timer; int enabled, r; uint64_t now; assert(f); assert(f->post_change_timer); - timer = f->post_change_timer; - - r = sd_event_source_get_enabled(timer, &enabled); + r = sd_event_source_get_enabled(f->post_change_timer, &enabled); if (r < 0) { log_debug_errno(r, "Failed to get ftruncate timer state: %m"); goto fail; @@ -1887,19 +1884,19 @@ static void schedule_post_change(JournalFile *f) { if (enabled == SD_EVENT_ONESHOT) return; - r = sd_event_now(sd_event_source_get_event(timer), CLOCK_MONOTONIC, &now); + r = sd_event_now(sd_event_source_get_event(f->post_change_timer), CLOCK_MONOTONIC, &now); if (r < 0) { log_debug_errno(r, "Failed to get clock's now for scheduling ftruncate: %m"); goto fail; } - r = sd_event_source_set_time(timer, now+f->post_change_timer_period); + r = sd_event_source_set_time(f->post_change_timer, now + f->post_change_timer_period); if (r < 0) { log_debug_errno(r, "Failed to set time for scheduling ftruncate: %m"); goto fail; } - r = sd_event_source_set_enabled(timer, SD_EVENT_ONESHOT); + r = sd_event_source_set_enabled(f->post_change_timer, SD_EVENT_ONESHOT); if (r < 0) { log_debug_errno(r, "Failed to enable scheduled ftruncate: %m"); goto fail; -- cgit v1.2.3