From 84dcaab5f47b0346d29540539ddfc6e4ee7baef0 Mon Sep 17 00:00:00 2001 From: Charles Kerr Date: Wed, 22 Oct 2008 13:57:30 +0000 Subject: [PATCH] remove dead code --- libtransmission/bencode.c | 106 ------------------------------------- libtransmission/natpmp.c | 7 +-- libtransmission/net.c | 15 +----- libtransmission/peer-mgr.c | 9 ++-- libtransmission/rpc-test.c | 53 ------------------- 5 files changed, 5 insertions(+), 185 deletions(-) diff --git a/libtransmission/bencode.c b/libtransmission/bencode.c index 70e9508d6..0bc70268e 100644 --- a/libtransmission/bencode.c +++ b/libtransmission/bencode.c @@ -1071,112 +1071,6 @@ tr_bencFree( tr_benc * val ) **** ***/ -#if 0 -struct WalkPrint -{ - int depth; - FILE * out; -}; -static void -printLeadingSpaces( struct WalkPrint * data ) -{ - const int width = data->depth * 2; - - fprintf( data->out, "%*.*s", width, width, " " ); -} - -static void -printIntFunc( const tr_benc * val, - void * vdata ) -{ - struct WalkPrint * data = vdata; - - printLeadingSpaces( data ); - fprintf( data->out, "int: %" PRId64 "\n", val->val.i ); -} - -static void -printStringFunc( const tr_benc * val, - void * vdata ) -{ - int i; - struct WalkPrint * data = vdata; - - printLeadingSpaces( data ); - fprintf( data->out, "string: " ); - for( i = 0; i < val->val.s.i; ++i ) - { - if( '\\' == val->val.s.s[i] ) - { - putc( '\\', data->out ); - putc( '\\', data->out ); - } - else if( isprint( val->val.s.s[i] ) ) - { - putc( val->val.s.s[i], data->out ); - } - else - { - fprintf( data->out, "\\x%02x", val->val.s.s[i] ); - } - } - fprintf( data->out, "\n" ); -} - -static void -printListBeginFunc( const tr_benc * val UNUSED, - void * vdata ) -{ - struct WalkPrint * data = vdata; - - printLeadingSpaces( data ); - fprintf( data->out, "list\n" ); - ++data->depth; -} - -static void -printDictBeginFunc( const tr_benc * val UNUSED, - void * vdata ) -{ - struct WalkPrint * data = vdata; - - printLeadingSpaces( data ); - fprintf( data->out, "dict\n" ); - ++data->depth; -} - -static void -printContainerEndFunc( const tr_benc * val UNUSED, - void * vdata ) -{ - struct WalkPrint * data = vdata; - - --data->depth; -} - -void -tr_bencPrint( const tr_benc * val ) -{ - struct WalkFuncs walkFuncs; - struct WalkPrint walkPrint; - - walkFuncs.intFunc = printIntFunc; - walkFuncs.stringFunc = printStringFunc; - walkFuncs.dictBeginFunc = printDictBeginFunc; - walkFuncs.listBeginFunc = printListBeginFunc; - walkFuncs.containerEndFunc = printContainerEndFunc; - - walkPrint.out = stderr; - walkPrint.depth = 0; - bencWalk( val, &walkFuncs, &walkPrint ); -} - -#endif - -/*** -**** -***/ - struct ParentState { int bencType; diff --git a/libtransmission/natpmp.c b/libtransmission/natpmp.c index 43def62ec..d205eabbd 100644 --- a/libtransmission/natpmp.c +++ b/libtransmission/natpmp.c @@ -15,17 +15,12 @@ #include #include -#ifdef WIN32 - #include /* inet_ntoa */ -#else - #include /* inet_ntoa */ -#endif - #define ENABLE_STRNATPMPERR #include #include "transmission.h" #include "natpmp.h" +#include "net.h" /* inet_ntoa() */ #include "port-forwarding.h" #include "utils.h" diff --git a/libtransmission/net.c b/libtransmission/net.c index 02b628759..ce6ca95ba 100644 --- a/libtransmission/net.c +++ b/libtransmission/net.c @@ -119,20 +119,7 @@ makeSocketNonBlocking( int fd ) static int createSocket( int type ) { - int fd = tr_fdSocketCreate( type ); - - if( fd >= 0 ) - fd = makeSocketNonBlocking( fd ); - -#if 0 - if( fd >= 0 ) - { - const int buffsize = 1500 * 3; /* 3x MTU for most ethernet/wireless */ - setsockopt( fd, SOL_SOCKET, SO_SNDBUF, &buffsize, sizeof( buffsize ) ); - } -#endif - - return fd; + return makeSocketNonBlocking( tr_fdSocketCreate( type ) ); } int diff --git a/libtransmission/peer-mgr.c b/libtransmission/peer-mgr.c index bf7e7a987..f781d8d72 100644 --- a/libtransmission/peer-mgr.c +++ b/libtransmission/peer-mgr.c @@ -14,7 +14,6 @@ #include #include /* memcpy, memcmp, strstr */ #include /* qsort */ -#include /* printf */ #include /* INT_MAX */ #include @@ -1754,11 +1753,9 @@ tr_peerMgrWebSpeeds( const tr_peerMgr * manager, } struct tr_peer_stat * -tr_peerMgrPeerStats( - const tr_peerMgr * manager, - const uint8_t * - torrentHash, - int * setmeCount UNUSED ) +tr_peerMgrPeerStats( const tr_peerMgr * manager, + const uint8_t * torrentHash, + int * setmeCount UNUSED ) { int i, size; const Torrent * t; diff --git a/libtransmission/rpc-test.c b/libtransmission/rpc-test.c index 5354c8745..c9e8eab03 100644 --- a/libtransmission/rpc-test.c +++ b/libtransmission/rpc-test.c @@ -24,57 +24,6 @@ static int test = 0; } \ } -#if 0 -extern char* cidrize( const char * in ); - -extern int tr_rpcTestACL( const void * unused, - const char * acl, - char ** setme_errmsg ); - -static int -testWildcard( const char * in, - const char * expected ) -{ - int ok; - char * str = cidrize( in ); - -/* fprintf( stderr, "in [%s] out [%s] expected [%s]\n", in, str, expected ); */ - ok = expected ? !strcmp( expected, str ) : !str; - tr_free( str ); - return ok; -} -#endif - -static int -test_acl( void ) -{ -#if 0 - int err; - char * errmsg = NULL; - - check( testWildcard( "192.*.*.*", "192.0.0.0/8" ) ); - check( testWildcard( "192.64.*.*", "192.64.0.0/16" ) ); - check( testWildcard( "192.64.0.*", "192.64.0.0/24" ) ); - check( testWildcard( "192.64.0.1", "192.64.0.1/32" ) ); - check( testWildcard( "+192.*.*.*,-192.64.*.*", - "+192.0.0.0/8,-192.64.0.0/16" ) ); - - err = tr_rpcTestACL( NULL, "+192.*.*.*", &errmsg ); - check( !err ); - check( !errmsg ); - err = tr_rpcTestACL( NULL, "+192.*.8.*", &errmsg ); - check( err ); - check( errmsg ); - tr_free( errmsg ); - errmsg = NULL; - err = tr_rpcTestACL( NULL, "+192.*.*.*,-192.168.*.*", &errmsg ); - check( !err ); - check( !errmsg ); -#endif - - return 0; -} - static int test_list( void ) { @@ -130,8 +79,6 @@ main( void ) { int i; - if( ( i = test_acl( ) ) ) - return i; if( ( i = test_list( ) ) ) return i;