]> granicus.if.org Git - transmission/commitdiff
(trunk libT) remove a small number of redundant or unnecessary asserts
authorCharles Kerr <charles@transmissionbt.com>
Thu, 8 Jan 2009 04:43:00 +0000 (04:43 +0000)
committerCharles Kerr <charles@transmissionbt.com>
Thu, 8 Jan 2009 04:43:00 +0000 (04:43 +0000)
libtransmission/peer-io.c
libtransmission/utils.h

index 7f50125e194e0f35e800bee098c824d55ddf49e7..717e121529aa2d2e8346e374fcc4ba1ee0f2ae3e 100644 (file)
@@ -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
index 2fce16d75deccc80041a7ecfd5391db31a49a482..cb4c0f7328b391fa908bec3d56c78ea63e6d26d3 100644 (file)
@@ -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() */