From efdd616118a7878faa6ae0f630b213cafe4bc96d Mon Sep 17 00:00:00 2001 From: Daniel Stenberg Date: Tue, 27 Aug 2013 13:06:57 +0200 Subject: [PATCH] timeoffset: made static and private ares__timeoffset() was only used once within this single source file --- ares_private.h | 3 --- ares_process.c | 9 --------- ares_timeout.c | 9 ++++++++- 3 files changed, 8 insertions(+), 13 deletions(-) diff --git a/ares_private.h b/ares_private.h index 50e4120..8f486a4 100644 --- a/ares_private.h +++ b/ares_private.h @@ -311,9 +311,6 @@ struct ares_channeldata { int ares__timedout(struct timeval *now, struct timeval *check); -/* return time offset between now and (future) check, in milliseconds */ -long ares__timeoffset(struct timeval *now, - struct timeval *check); /* returns ARES_SUCCESS if library has been initialized */ int ares_library_initialized(void); void ares__send_query(ares_channel channel, struct query *query, diff --git a/ares_process.c b/ares_process.c index 166d632..e34b4b6 100644 --- a/ares_process.c +++ b/ares_process.c @@ -115,15 +115,6 @@ static timeadd(struct timeval *now, int millisecs) return 0; } -/* return time offset between now and (future) check, in milliseconds */ -long ares__timeoffset(struct timeval *now, - struct timeval *check) -{ - return (check->tv_sec - now->tv_sec)*1000 + - (check->tv_usec - now->tv_usec)/1000; -} - - /* * generic process function */ diff --git a/ares_timeout.c b/ares_timeout.c index 0b5a435..293e4af 100644 --- a/ares_timeout.c +++ b/ares_timeout.c @@ -23,6 +23,13 @@ #include "ares.h" #include "ares_private.h" +/* return time offset between now and (future) check, in milliseconds */ +static long timeoffset(struct timeval *now, struct timeval *check) +{ + return (check->tv_sec - now->tv_sec)*1000 + + (check->tv_usec - now->tv_usec)/1000; +} + /* WARNING: Beware that this is linear in the number of outstanding * requests! You are probably far better off just calling ares_process() * once per second, rather than calling ares_timeout() to figure out @@ -53,7 +60,7 @@ struct timeval *ares_timeout(ares_channel channel, struct timeval *maxtv, query = list_node->data; if (query->timeout.tv_sec == 0) continue; - offset = ares__timeoffset(&now, &query->timeout); + offset = timeoffset(&now, &query->timeout); if (offset < 0) offset = 0; if (min_offset == -1 || offset < min_offset)