From 4322837189536dbd93eb6fb4c5e8c93795a015ac Mon Sep 17 00:00:00 2001 From: Charles Kerr Date: Mon, 23 Nov 2009 21:57:10 +0000 Subject: [PATCH] (trunk) remove dead code --- gtk/details.c | 2 -- libtransmission/JSON_parser.c | 2 +- libtransmission/bandwidth.c | 4 ---- libtransmission/magnet.c | 20 ++++++++++---------- libtransmission/peer-mgr.c | 33 +-------------------------------- 5 files changed, 12 insertions(+), 49 deletions(-) diff --git a/gtk/details.c b/gtk/details.c index 5d108e751..4ed31da8a 100644 --- a/gtk/details.c +++ b/gtk/details.c @@ -2179,12 +2179,10 @@ torrent_inspector_set_torrents( GtkWidget * w, GSList * ids ) g_snprintf( title, sizeof( title ), _( "%s Properties" ), inf->name ); file_list_set_torrent( di->file_list, id ); - //tracker_list_set_torrent( di->tracker_list, id ); } else { file_list_clear( di->file_list ); - //tracker_list_clear( di->tracker_list ); g_snprintf( title, sizeof( title ), _( "%'d Torrent Properties" ), len ); } diff --git a/libtransmission/JSON_parser.c b/libtransmission/JSON_parser.c index 8e2035000..e9b17f52b 100644 --- a/libtransmission/JSON_parser.c +++ b/libtransmission/JSON_parser.c @@ -71,7 +71,7 @@ SOFTWARE. #ifdef _MSC_VER # if _MSC_VER >= 1400 /* Visual Studio 2005 and up */ -# pragma warning(disable:4996) // unsecure sscanf +# pragma warning(disable:4996) /* unsecure sscanf */ # endif #endif diff --git a/libtransmission/bandwidth.c b/libtransmission/bandwidth.c index f5f92801f..25f4fd859 100644 --- a/libtransmission/bandwidth.c +++ b/libtransmission/bandwidth.c @@ -119,7 +119,6 @@ tr_bandwidthSetParent( tr_bandwidth * b, assert( tr_isBandwidth( b ) ); assert( b != parent ); -//fprintf( stderr, "setting parent for %p: %p\n", b, parent ); if( b->parent ) { void * removed; @@ -129,7 +128,6 @@ tr_bandwidthSetParent( tr_bandwidth * b, removed = tr_ptrArrayRemoveSorted( &b->parent->children, b, comparePointers ); assert( removed == b ); assert( tr_ptrArrayFindSorted( &b->parent->children, b, comparePointers ) == NULL ); -//fprintf( stderr, "removed child bandwidth %p from old parent %p\n", b, b->parent ); b->parent = NULL; } @@ -141,7 +139,6 @@ tr_bandwidthSetParent( tr_bandwidth * b, tr_ptrArrayInsertSorted( &parent->children, b, comparePointers ); assert( tr_ptrArrayFindSorted( &parent->children, b, comparePointers ) == b ); -//fprintf( stderr, "set new parent for %p: %p\n", b, parent ); b->parent = parent; } } @@ -149,7 +146,6 @@ tr_bandwidthSetParent( tr_bandwidth * b, /*** **** ***/ - #if 0 #warning do not check the code in with this enabled #define DEBUG_DIRECTION TR_UP diff --git a/libtransmission/magnet.c b/libtransmission/magnet.c index 5bad83e7c..210249672 100644 --- a/libtransmission/magnet.c +++ b/libtransmission/magnet.c @@ -28,16 +28,16 @@ static const int base32Lookup[] = { - 0xFF,0xFF,0x1A,0x1B,0x1C,0x1D,0x1E,0x1F, // '0', '1', '2', '3', '4', '5', '6', '7' - 0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF, // '8', '9', ':', ';', '<', '=', '>', '?' - 0xFF,0x00,0x01,0x02,0x03,0x04,0x05,0x06, // '@', 'A', 'B', 'C', 'D', 'E', 'F', 'G' - 0x07,0x08,0x09,0x0A,0x0B,0x0C,0x0D,0x0E, // 'H', 'I', 'J', 'K', 'L', 'M', 'N', 'O' - 0x0F,0x10,0x11,0x12,0x13,0x14,0x15,0x16, // 'P', 'Q', 'R', 'S', 'T', 'U', 'V', 'W' - 0x17,0x18,0x19,0xFF,0xFF,0xFF,0xFF,0xFF, // 'X', 'Y', 'Z', '[', '\', ']', '^', '_' - 0xFF,0x00,0x01,0x02,0x03,0x04,0x05,0x06, // '`', 'a', 'b', 'c', 'd', 'e', 'f', 'g' - 0x07,0x08,0x09,0x0A,0x0B,0x0C,0x0D,0x0E, // 'h', 'i', 'j', 'k', 'l', 'm', 'n', 'o' - 0x0F,0x10,0x11,0x12,0x13,0x14,0x15,0x16, // 'p', 'q', 'r', 's', 't', 'u', 'v', 'w' - 0x17,0x18,0x19,0xFF,0xFF,0xFF,0xFF,0xFF // 'x', 'y', 'z', '{', '|', '}', '~', 'DEL' + 0xFF,0xFF,0x1A,0x1B,0x1C,0x1D,0x1E,0x1F, /* '0', '1', '2', '3', '4', '5', '6', '7' */ + 0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF, /* '8', '9', ':', ';', '<', '=', '>', '?' */ + 0xFF,0x00,0x01,0x02,0x03,0x04,0x05,0x06, /* '@', 'A', 'B', 'C', 'D', 'E', 'F', 'G' */ + 0x07,0x08,0x09,0x0A,0x0B,0x0C,0x0D,0x0E, /* 'H', 'I', 'J', 'K', 'L', 'M', 'N', 'O' */ + 0x0F,0x10,0x11,0x12,0x13,0x14,0x15,0x16, /* 'P', 'Q', 'R', 'S', 'T', 'U', 'V', 'W' */ + 0x17,0x18,0x19,0xFF,0xFF,0xFF,0xFF,0xFF, /* 'X', 'Y', 'Z', '[', '\', ']', '^', '_' */ + 0xFF,0x00,0x01,0x02,0x03,0x04,0x05,0x06, /* '`', 'a', 'b', 'c', 'd', 'e', 'f', 'g' */ + 0x07,0x08,0x09,0x0A,0x0B,0x0C,0x0D,0x0E, /* 'h', 'i', 'j', 'k', 'l', 'm', 'n', 'o' */ + 0x0F,0x10,0x11,0x12,0x13,0x14,0x15,0x16, /* 'p', 'q', 'r', 's', 't', 'u', 'v', 'w' */ + 0x17,0x18,0x19,0xFF,0xFF,0xFF,0xFF,0xFF /* 'x', 'y', 'z', '{', '|', '}', '~', 'DEL' */ }; static const int base32LookupLen = sizeof( base32Lookup ) / sizeof( base32Lookup[0] ); diff --git a/libtransmission/peer-mgr.c b/libtransmission/peer-mgr.c index ae331eb13..d32c9f472 100644 --- a/libtransmission/peer-mgr.c +++ b/libtransmission/peer-mgr.c @@ -152,8 +152,6 @@ struct weighted_piece typedef struct tr_torrent_peers { - struct event refillTimer; - tr_ptrArray outgoingHandshakes; /* tr_handshake */ tr_ptrArray pool; /* struct peer_atom */ tr_ptrArray peers; /* tr_peer */ @@ -162,7 +160,6 @@ typedef struct tr_torrent_peers tr_torrent * tor; tr_peer * optimistic; /* the optimistic peer, or NULL if none */ struct tr_peerMgr * manager; - //int * pendingRequestCount; tr_bool isRunning; tr_bool needsCompletenessCheck; @@ -427,8 +424,6 @@ torrentDestructor( void * vt ) assert( tr_ptrArrayEmpty( &t->outgoingHandshakes ) ); assert( tr_ptrArrayEmpty( &t->peers ) ); - evtimer_del( &t->refillTimer ); - tr_ptrArrayDestruct( &t->webseeds, (PtrArrayForeachFunc)tr_webseedFree ); tr_ptrArrayDestruct( &t->pool, (PtrArrayForeachFunc)tr_free ); tr_ptrArrayDestruct( &t->outgoingHandshakes, NULL ); @@ -439,12 +434,7 @@ torrentDestructor( void * vt ) tr_free( t ); } - -//static void refillPulse( int, short, void* ); - -static void peerCallbackFunc( void * vpeer, - void * vevent, - void * vt ); +static void peerCallbackFunc( void * vpeer, void * vevent, void * vt ); static Torrent* torrentConstructor( tr_peerMgr * manager, @@ -461,8 +451,6 @@ torrentConstructor( tr_peerMgr * manager, t->webseeds = TR_PTR_ARRAY_INIT; t->outgoingHandshakes = TR_PTR_ARRAY_INIT; t->requests = 0; - //evtimer_set( &t->refillTimer, refillPulse, t ); - for( i = 0; i < tor->info.webseedCount; ++i ) { @@ -616,7 +604,6 @@ requestListSort( Torrent * t, int mode ) default: assert( 0 && "unhandled" ); } -//fprintf( stderr, "sorting requests by %s\n", (mode==REQ_SORTED_BY_BLOCK)?"block":"time" ); qsort( t->requests, t->requestCount, sizeof( struct block_request ), compar ); } @@ -754,7 +741,6 @@ pieceListSort( Torrent * t, int mode ) if( t->piecesSort != mode ) { -//fprintf( stderr, "sort mode was %d, is now %d\n", t->piecesSort, mode ); t->piecesSort = mode; switch( mode ) { @@ -763,7 +749,6 @@ pieceListSort( Torrent * t, int mode ) default: assert( 0 && "unhandled" ); break; } -//fprintf( stderr, "sorting pieces by %s...\n", (mode==PIECES_SORTED_BY_WEIGHT)?"weight":"index" ); weightTorrent = t->tor; qsort( t->pieces, t->pieceCount, sizeof( struct weighted_piece ), compar ); @@ -936,16 +921,6 @@ tr_peerMgrGetNextRequests( tr_torrent * tor, if( t->pieces == NULL ) pieceListRebuild( t ); pieceListSort( t, PIECES_SORTED_BY_WEIGHT ); -//if( t->isInEndgame ) fprintf( stderr, "endgame\n" ); - -#if 0 -{ -int i=0, n=MIN(10,t->pieceCount); -fprintf( stderr, "the next pieces we want to request are " ); -for( i=0; ipieces[i].index, (int)t->pieces[i].weight ); -fprintf( stderr, "\n" ); -} -#endif pieces = t->pieces; for( i=0; ipieceCount && gottor; -//fprintf( stderr, "sorting %d changed pieces...\n", (int)(a_end-a) ); qsort( a, a_end-a, sizeof( struct weighted_piece ), comparePieceByWeight ); /* allocate a new array */ @@ -1024,7 +997,6 @@ fprintf( stderr, "\n" ); t->pieces = pieces; } - //fprintf( stderr, "peer %p wanted %d requests; got %d\n", peer, numwant, got ); *numgot = got; } @@ -1327,8 +1299,6 @@ peerCallbackFunc( void * vpeer, void * vevent, void * vt ) { tr_torrent * tor = t->tor; tr_block_index_t block = _tr_block( tor, e->pieceIndex, e->offset ); -//static int numBlocks = 0; -//fprintf( stderr, "got a total of %d blocks\n", ++numBlocks ); requestListRemove( t, block ); pieceListRemoveRequest( t, block ); @@ -1347,7 +1317,6 @@ peerCallbackFunc( void * vpeer, void * vevent, void * vt ) { const tr_piece_index_t p = e->pieceIndex; const tr_bool ok = tr_ioTestPiece( tor, p, NULL, 0 ); -//fprintf( stderr, "we now have piece #%d\n", (int)p ); if( !ok ) {