(trunk libT) more speed tweaks from valgrind

This commit is contained in:
Charles Kerr 2009-04-12 14:52:17 +00:00
parent e46700022b
commit a2b53f5cbd
2 changed files with 4 additions and 8 deletions

View File

@ -180,7 +180,7 @@ tr_pton( const char * src, tr_address * dst )
int
tr_compareAddresses( const tr_address * a, const tr_address * b)
{
int addrlen;
static const int sizes[2] = { sizeof(struct in_addr), sizeof(struct in6_addr) };
assert( tr_isAddress( a ) );
assert( tr_isAddress( b ) );
@ -189,11 +189,7 @@ tr_compareAddresses( const tr_address * a, const tr_address * b)
if( a->type != b->type )
return a->type == TR_AF_INET ? 1 : -1;
if( a->type == TR_AF_INET )
addrlen = sizeof( struct in_addr );
else
addrlen = sizeof( struct in6_addr );
return memcmp( &a->addr, &b->addr, addrlen );
return memcmp( &a->addr, &b->addr, sizes[a->type] );
}
tr_bool

View File

@ -743,8 +743,8 @@ tr_peerIoReadBytes( tr_peerIo * io,
break;
case PEER_ENCRYPTION_RC4:
evbuffer_remove( inbuf, bytes, byteCount );
tr_cryptoDecrypt( io->crypto, byteCount, bytes, bytes );
tr_cryptoDecrypt( io->crypto, byteCount, EVBUFFER_DATA(inbuf), bytes );
evbuffer_drain(inbuf, byteCount );
break;
default: