From fb93ea4f179d3ff5ab5fb4612bd4c9a6db9b4e70 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sa=C3=BAl=20Ibarra=20Corretg=C3=A9?= Date: Thu, 4 Sep 2014 14:14:13 +0200 Subject: [PATCH] windows: simplify code in uv_timer_again Remove duplicated code by directly calling uv_timer_stop --- src/win/timer.c | 18 ++---------------- 1 file changed, 2 insertions(+), 16 deletions(-) diff --git a/src/win/timer.c b/src/win/timer.c index c229d4c8..6c49d11b 100644 --- a/src/win/timer.c +++ b/src/win/timer.c @@ -155,28 +155,14 @@ int uv_timer_stop(uv_timer_t* handle) { int uv_timer_again(uv_timer_t* handle) { - uv_loop_t* loop = handle->loop; - /* If timer_cb is NULL that means that the timer was never started. */ if (!handle->timer_cb) { return UV_EINVAL; } - if (handle->flags & UV_HANDLE_ACTIVE) { - RB_REMOVE(uv_timer_tree_s, &loop->timers, handle); - handle->flags &= ~UV_HANDLE_ACTIVE; - uv__handle_stop(handle); - } - if (handle->repeat) { - handle->due = get_clamped_due_time(loop->time, handle->repeat); - - if (RB_INSERT(uv_timer_tree_s, &loop->timers, handle) != NULL) { - uv_fatal_error(ERROR_INVALID_DATA, "RB_INSERT"); - } - - handle->flags |= UV_HANDLE_ACTIVE; - uv__handle_start(handle); + uv_timer_stop(handle); + uv_timer_start(handle, handle->timer_cb, handle->repeat, handle->repeat); } return 0;