From ed1df8beac0e8818a6149e0ef69de1658a1c7d78 Mon Sep 17 00:00:00 2001 From: Charles Kerr Date: Sat, 12 Dec 2009 01:05:29 +0000 Subject: [PATCH] (trunk libT) removed dead code: tr_isTimeval(), tr_timevalMsec(), tr_timevalSet() --- libtransmission/tr-dht.c | 4 ++-- libtransmission/utils.c | 36 ++++++++---------------------------- libtransmission/utils.h | 8 -------- 3 files changed, 10 insertions(+), 38 deletions(-) diff --git a/libtransmission/tr-dht.c b/libtransmission/tr-dht.c index 36be305b9..e0ba1c3f5 100644 --- a/libtransmission/tr-dht.c +++ b/libtransmission/tr-dht.c @@ -84,8 +84,8 @@ static void nap( int roughly ) { struct timeval tv; - tr_timevalSet( &tv, roughly / 2 + tr_cryptoWeakRandInt( roughly ), - tr_cryptoWeakRandInt( 1000000 ) ); + tv.tv_sec = roughly / 2 + tr_cryptoWeakRandInt( roughly ); + tv.tv_usec = tr_cryptoWeakRandInt( 1000000 ); select( 0, NULL, NULL, NULL, &tv ); } diff --git a/libtransmission/utils.c b/libtransmission/utils.c index 03d53f0eb..f5a1cf76b 100644 --- a/libtransmission/utils.c +++ b/libtransmission/utils.c @@ -465,38 +465,18 @@ tr_strip_positional_args( const char* str ) *** **/ -tr_bool -tr_isTimeval( const struct timeval * tv ) -{ - return tv && ( tv->tv_sec >= 0 ) - && ( tv->tv_usec >= 0 ) - && ( tv->tv_usec < 1000000 ); -} - -void -tr_timevalMsec( uint64_t milliseconds, struct timeval * setme ) -{ - const uint64_t microseconds = milliseconds * 1000; - assert( setme != NULL ); - setme->tv_sec = microseconds / 1000000; - setme->tv_usec = microseconds % 1000000; - assert( tr_isTimeval( setme ) ); -} - -void -tr_timevalSet( struct timeval * setme, int seconds, int microseconds ) -{ - setme->tv_sec = seconds; - setme->tv_usec = microseconds; - assert( tr_isTimeval( setme ) ); -} - void tr_timerAdd( struct event * timer, int seconds, int microseconds ) { struct timeval tv; - tr_timevalSet( &tv, seconds, microseconds ); - event_add( timer, &tv ); + tv.tv_sec = seconds; + tv.tv_usec = microseconds; + + assert( tv.tv_sec >= 0 ); + assert( tv.tv_usec >= 0 ); + assert( tv.tv_usec < 1000000 ); + + evtimer_add( timer, &tv ); } void diff --git a/libtransmission/utils.h b/libtransmission/utils.h index 506cbfde3..aa00e252b 100644 --- a/libtransmission/utils.h +++ b/libtransmission/utils.h @@ -253,14 +253,6 @@ uint8_t* tr_loadFile( const char * filename, size_t * size ) TR_GNUC_MALLOC TR_G char* tr_buildPath( const char * first_element, ... ) TR_GNUC_NULL_TERMINATED TR_GNUC_MALLOC; -struct timeval; - -tr_bool tr_isTimeval( const struct timeval * tv ); - -void tr_timevalMsec( uint64_t milliseconds, struct timeval * setme ); - -void tr_timevalSet( struct timeval * setme, int seconds, int microseconds ); - struct event; void tr_timerAdd( struct event * timer, int seconds, int microseconds );