From 743e04bfd632368872eb6173639c507b9c2bc833 Mon Sep 17 00:00:00 2001 From: Willem Toorop Date: Thu, 8 Dec 2016 14:44:24 +0100 Subject: [PATCH] Replace ((uint64_t)-1) with TIMEOUT_FOREVER --- src/extension/default_eventloop.c | 9 +++++---- src/ub_loop.c | 2 +- 2 files changed, 6 insertions(+), 5 deletions(-) diff --git a/src/extension/default_eventloop.c b/src/extension/default_eventloop.c index 671c3955..b05d8ec3 100644 --- a/src/extension/default_eventloop.c +++ b/src/extension/default_eventloop.c @@ -27,6 +27,7 @@ #include "extension/default_eventloop.h" #include "debug.h" +#include "types-internal.h" static uint64_t get_now_plus(uint64_t amount) { @@ -40,7 +41,7 @@ static uint64_t get_now_plus(uint64_t amount) now = tv.tv_sec * 1000000 + tv.tv_usec; return (now + amount * 1000) >= now - ? now + amount * 1000 : 0xFFFFFFFFFFFFFFFF; + ? now + amount * 1000 : TIMEOUT_FOREVER; } static getdns_return_t @@ -183,7 +184,7 @@ default_eventloop_run_once(getdns_eventloop *loop, int blocking) fd_set readfds, writefds; int fd, max_fd = -1; - uint64_t now, timeout = 0xFFFFFFFFFFFFFFFF; + uint64_t now, timeout = TIMEOUT_FOREVER; size_t i; struct timeval tv; @@ -214,7 +215,7 @@ default_eventloop_run_once(getdns_eventloop *loop, int blocking) if (default_loop->fd_timeout_times[fd] < timeout) timeout = default_loop->fd_timeout_times[fd]; } - if (max_fd == -1 && timeout == 0xFFFFFFFFFFFFFFFF) + if (max_fd == -1 && timeout == TIMEOUT_FOREVER) return; if (! blocking || now > timeout) { @@ -225,7 +226,7 @@ default_eventloop_run_once(getdns_eventloop *loop, int blocking) tv.tv_usec = (timeout - now) % 1000000; } if (select(max_fd + 1, &readfds, &writefds, NULL, - (timeout == 0xFFFFFFFFFFFFFFFF ? NULL : &tv)) < 0) { + (timeout == TIMEOUT_FOREVER ? NULL : &tv)) < 0) { perror("select() failed"); exit(EXIT_FAILURE); } diff --git a/src/ub_loop.c b/src/ub_loop.c index c69d9070..c0040289 100644 --- a/src/ub_loop.c +++ b/src/ub_loop.c @@ -414,7 +414,7 @@ static struct ub_event* my_event_new(struct ub_event_base* base, int fd, ev->added = 0; ev->fd = fd; ev->bits = bits; - ev->timeout = 0xFFFFFFFFFFFFFFFF; + ev->timeout = TIMEOUT_FOREVER; ev->cb = cb; ev->arg = arg; #ifdef USE_WINSOCK