remove dead code

This commit is contained in:
Charles Kerr 2008-10-22 13:57:30 +00:00
parent 65f566927a
commit 84dcaab5f4
5 changed files with 5 additions and 185 deletions

View File

@ -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;

View File

@ -15,17 +15,12 @@
#include <time.h>
#include <inttypes.h>
#ifdef WIN32
#include <winsock2.h> /* inet_ntoa */
#else
#include <arpa/inet.h> /* inet_ntoa */
#endif
#define ENABLE_STRNATPMPERR
#include <libnatpmp/natpmp.h>
#include "transmission.h"
#include "natpmp.h"
#include "net.h" /* inet_ntoa() */
#include "port-forwarding.h"
#include "utils.h"

View File

@ -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

View File

@ -14,7 +14,6 @@
#include <errno.h>
#include <string.h> /* memcpy, memcmp, strstr */
#include <stdlib.h> /* qsort */
#include <stdio.h> /* printf */
#include <limits.h> /* INT_MAX */
#include <event.h>
@ -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;

View File

@ -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;