From: Charles Kerr Date: Thu, 8 Jan 2009 04:43:00 +0000 (+0000) Subject: (trunk libT) remove a small number of redundant or unnecessary asserts X-Git-Tag: 1.60~535 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=98420365e9e484d2429af66cc6268b30e39e0a4c;p=transmission (trunk libT) remove a small number of redundant or unnecessary asserts --- diff --git a/libtransmission/peer-io.c b/libtransmission/peer-io.c index 7f50125e1..717e12152 100644 --- a/libtransmission/peer-io.c +++ b/libtransmission/peer-io.c @@ -172,12 +172,7 @@ tr_isPeerIo( const tr_peerIo * io ) && ( io->magicNumber == MAGIC_NUMBER ) && ( io->refCount > 0 ) && ( tr_isBandwidth( &io->bandwidth ) ) - && ( tr_isAddress( &io->addr ) ) - && ( tr_isBool( io->isEncrypted ) ) - && ( tr_isBool( io->isIncoming ) ) - && ( tr_isBool( io->peerIdIsSet ) ) - && ( tr_isBool( io->extendedProtocolSupported ) ) - && ( tr_isBool( io->fastExtensionSupported ) ); + && ( tr_isAddress( &io->addr ) ); } static void @@ -841,8 +836,6 @@ tr_peerIoFlush( tr_peerIo * io, tr_direction dir, size_t limit ) static void event_enable( tr_peerIo * io, short event ) { - assert( tr_isPeerIo( io ) ); - if( event & EV_READ ) event_add( &io->event_read, NULL ); @@ -853,8 +846,6 @@ event_enable( tr_peerIo * io, short event ) static void event_disable( struct tr_peerIo * io, short event ) { - assert( tr_isPeerIo( io ) ); - if( event & EV_READ ) event_del( &io->event_read ); @@ -868,13 +859,11 @@ tr_peerIoSetEnabled( tr_peerIo * io, tr_direction dir, tr_bool isEnabled ) { - short event; + const short event = dir == TR_UP ? EV_WRITE : EV_READ; assert( tr_isPeerIo( io ) ); assert( tr_isDirection( dir ) ); - event = dir == TR_UP ? EV_WRITE : EV_READ; - if( isEnabled ) event_enable( io, event ); else diff --git a/libtransmission/utils.h b/libtransmission/utils.h index 2fce16d75..cb4c0f732 100644 --- a/libtransmission/utils.h +++ b/libtransmission/utils.h @@ -300,7 +300,7 @@ char* tr_strndup( const void * str, int len ) TR_GNUC_MALLOC; static inline char* tr_strdup( const void * in ) { - return tr_strndup( in, in ? strlen( (const char*)in ) : 0 ); + return tr_strndup( in, in ? strlen( in ) : 0 ); } /* @brief same argument list as bsearch() */