From 856546f4c7daafaa84ac5db0e8b5d30e8d845fb8 Mon Sep 17 00:00:00 2001 From: Joachim Nilsson Date: Sun, 28 Jan 2018 21:36:47 +0100 Subject: [PATCH] Refactor, simplify Signed-off-by: Joachim Nilsson --- src/uev.c | 11 +++-------- 1 file changed, 3 insertions(+), 8 deletions(-) diff --git a/src/uev.c b/src/uev.c index b03f601..8188c41 100644 --- a/src/uev.c +++ b/src/uev.c @@ -347,6 +347,8 @@ int uev_run(uev_ctx_t *ctx, int flags) if (!w->u.t.period) w->u.t.timeout = 0; + if (!w->u.t.timeout) + uev_timer_stop(w); break; case UEV_CRON_TYPE: @@ -362,16 +364,9 @@ int uev_run(uev_ctx_t *ctx, int flags) w->u.c.when = 0; else w->u.c.when += w->u.c.interval; - break; - } - - if (UEV_CRON_TYPE == w->type) { if (!w->u.c.when) uev_timer_stop(w); - } - if (UEV_TIMER_TYPE == w->type) { - if (!w->u.t.timeout) - uev_timer_stop(w); + break; } /*