From 0fd993195f7fea121d8d9d75c2d9d802435b3110 Mon Sep 17 00:00:00 2001 From: Yash Ladha Date: Thu, 16 Apr 2020 14:54:32 +0200 Subject: [PATCH] timer: remove redundant check in heap compare `timer_less_than()` function is basically a comparator function that returns true or false. In the end of the function we were checking for the comparison of id, but the later if is redundant as we are anyways in the end are returning `0`. That extra check can thus be safely removed. PR-URL: https://github.com/libuv/libuv/pull/2785 Reviewed-By: Ben Noordhuis Reviewed-By: Colin Ihrig --- src/timer.c | 7 +------ 1 file changed, 1 insertion(+), 6 deletions(-) diff --git a/src/timer.c b/src/timer.c index 9da513fc..4cf4ed42 100644 --- a/src/timer.c +++ b/src/timer.c @@ -51,12 +51,7 @@ static int timer_less_than(const struct heap_node* ha, /* Compare start_id when both have the same timeout. start_id is * allocated with loop->timer_counter in uv_timer_start(). */ - if (a->start_id < b->start_id) - return 1; - if (b->start_id < a->start_id) - return 0; - - return 0; + return a->start_id < b->start_id; }