From daaee855b251b1c5368b6a577a5fcba4bf7828c6 Mon Sep 17 00:00:00 2001 From: erdgeist <> Date: Tue, 28 Oct 2008 01:27:22 +0000 Subject: [PATCH] Whitespace fixes --- opentracker.c | 16 ++++++++-------- ot_accesslist.c | 2 +- ot_accesslist.h | 2 +- ot_clean.c | 2 +- ot_clean.h | 2 +- ot_fullscrape.c | 2 +- ot_fullscrape.h | 2 +- ot_http.c | 4 ++-- ot_http.h | 2 +- ot_iovec.c | 4 ++-- ot_iovec.h | 2 +- ot_livesync.c | 8 ++++---- ot_livesync.h | 8 ++++---- ot_mutex.c | 10 +++++----- ot_mutex.h | 2 +- ot_stats.c | 14 +++++++------- ot_stats.h | 4 ++-- ot_sync.c | 2 +- ot_sync.h | 2 +- ot_udp.c | 2 +- ot_udp.h | 2 +- ot_vector.c | 2 +- ot_vector.h | 2 +- scan_urlencoded_query.c | 2 +- scan_urlencoded_query.h | 4 ++-- trackerlogic.c | 8 ++++---- trackerlogic.h | 2 +- 27 files changed, 57 insertions(+), 57 deletions(-) diff --git a/opentracker.c b/opentracker.c index a831b06..f76c042 100644 --- a/opentracker.c +++ b/opentracker.c @@ -220,7 +220,7 @@ static void server_mainloop( ) { } livesync_ticker(); - + /* See if we need to move our pools */ if( NOW != ot_last_clean_time ) { ot_last_clean_time = NOW; @@ -254,10 +254,10 @@ static int64_t ot_try_bind( char ip[4], uint16_t port, PROTO_FLAG proto ) { io_wantread( s ); -#ifdef _DEBUG +#ifdef _DEBUG fputs( " success.\n", stderr); #endif - + return s; } @@ -291,19 +291,19 @@ int parse_configfile( char * config_filename ) { int bound = 0; accesslist_filehandle = fopen( config_filename, "r" ); - + if( accesslist_filehandle == NULL ) { fprintf( stderr, "Warning: Can't open config file: %s.", config_filename ); return 0; } - + while( fgets( inbuf, sizeof(inbuf), accesslist_filehandle ) ) { char *newl; char *p = inbuf; /* Skip white spaces */ while(isspace(*p)) ++p; - + /* Ignore comments and empty lines */ if((*p=='#')||(*p=='\n')||(*p==0)) continue; @@ -360,7 +360,7 @@ int parse_configfile( char * config_filename ) { fprintf( stderr, "Unhandled line in config file: %s\n", inbuf ); continue; parse_error: - fprintf( stderr, "Parse error in config file: %s\n", inbuf); + fprintf( stderr, "Parse error in config file: %s\n", inbuf); } fclose( accesslist_filehandle ); return bound; @@ -371,7 +371,7 @@ int main( int argc, char **argv ) { char serverip[4] = {0,0,0,0}, tmpip[4]; int bound = 0, scanon = 1; uint16_t tmpport; - + while( scanon ) { switch( getopt( argc, argv, ":i:p:A:P:d:r:s:f:v" #ifdef WANT_ACCESSLIST_BLACK diff --git a/ot_accesslist.c b/ot_accesslist.c index 91e99b3..59d3659 100644 --- a/ot_accesslist.c +++ b/ot_accesslist.c @@ -1,6 +1,6 @@ /* This software was written by Dirk Engling It is considered beerware. Prost. Skol. Cheers or whatever. - + $id$ */ /* System */ diff --git a/ot_accesslist.h b/ot_accesslist.h index 5d163c2..8d87710 100644 --- a/ot_accesslist.h +++ b/ot_accesslist.h @@ -1,6 +1,6 @@ /* This software was written by Dirk Engling It is considered beerware. Prost. Skol. Cheers or whatever. - + $id$ */ #ifndef __OT_ACCESSLIST_H__ diff --git a/ot_clean.c b/ot_clean.c index f8bb637..7ac86a8 100644 --- a/ot_clean.c +++ b/ot_clean.c @@ -1,6 +1,6 @@ /* This software was written by Dirk Engling It is considered beerware. Prost. Skol. Cheers or whatever. - + $id$ */ /* System */ diff --git a/ot_clean.h b/ot_clean.h index a06891e..7fefddb 100644 --- a/ot_clean.h +++ b/ot_clean.h @@ -1,6 +1,6 @@ /* This software was written by Dirk Engling It is considered beerware. Prost. Skol. Cheers or whatever. - + $id$ */ #ifndef __OT_CLEAN_H__ diff --git a/ot_fullscrape.c b/ot_fullscrape.c index abd8cee..fa17d61 100644 --- a/ot_fullscrape.c +++ b/ot_fullscrape.c @@ -1,6 +1,6 @@ /* This software was written by Dirk Engling It is considered beerware. Prost. Skol. Cheers or whatever. - + $id$ */ #ifdef WANT_FULLSCRAPE diff --git a/ot_fullscrape.h b/ot_fullscrape.h index 4025be1..3f5dc7d 100644 --- a/ot_fullscrape.h +++ b/ot_fullscrape.h @@ -1,6 +1,6 @@ /* This software was written by Dirk Engling It is considered beerware. Prost. Skol. Cheers or whatever. - + $id$ */ #ifndef __OT_FULLSCRAPE_H__ diff --git a/ot_http.c b/ot_http.c index 54564c7..09e93dd 100644 --- a/ot_http.c +++ b/ot_http.c @@ -1,6 +1,6 @@ /* This software was written by Dirk Engling It is considered beerware. Prost. Skol. Cheers or whatever. - + $id$ */ /* System */ @@ -335,7 +335,7 @@ static ssize_t http_handle_stats( const int64 client_socket, char *data, char *d stats_deliver( client_socket, mode ); return -2; } - + /* Simple stats can be answerred immediately */ if( !( l = return_stats_for_tracker( static_outbuf + SUCCESS_HTTP_HEADER_LENGTH, mode, 0 ) ) ) HTTPERROR_500; diff --git a/ot_http.h b/ot_http.h index 3570042..4d97769 100644 --- a/ot_http.h +++ b/ot_http.h @@ -1,6 +1,6 @@ /* This software was written by Dirk Engling It is considered beerware. Prost. Skol. Cheers or whatever. - + $id$ */ #ifndef __OT_HTTP_H__ diff --git a/ot_iovec.c b/ot_iovec.c index 70e017c..8f9c480 100644 --- a/ot_iovec.c +++ b/ot_iovec.c @@ -1,6 +1,6 @@ /* This software was written by Dirk Engling It is considered beerware. Prost. Skol. Cheers or whatever. - + $id$ */ /* System */ @@ -24,7 +24,7 @@ void *iovec_increase( int *iovec_entries, struct iovec **iovector, size_t new_al if( !new_ptr ) return NULL; ((*iovector)[*iovec_entries]).iov_base = new_ptr; - ((*iovector)[*iovec_entries]).iov_len = new_alloc; + ((*iovector)[*iovec_entries]).iov_len = new_alloc; ++*iovec_entries; return new_ptr; } diff --git a/ot_iovec.h b/ot_iovec.h index 02373e7..d5cf158 100644 --- a/ot_iovec.h +++ b/ot_iovec.h @@ -1,6 +1,6 @@ /* This software was written by Dirk Engling It is considered beerware. Prost. Skol. Cheers or whatever. - + $id$ */ #ifndef __OT_IOVEC_H__ diff --git a/ot_livesync.c b/ot_livesync.c index 92c947c..3e27c9a 100644 --- a/ot_livesync.c +++ b/ot_livesync.c @@ -1,6 +1,6 @@ /* This software was written by Dirk Engling It is considered beerware. Prost. Skol. Cheers or whatever. - + $id$ */ /* System */ @@ -54,7 +54,7 @@ void livesync_init( ) { pthread_create( &thread_id, NULL, livesync_worker, NULL ); } - + void livesync_deinit() { pthread_cancel( thread_id ); } @@ -106,7 +106,7 @@ void livesync_tell( ot_hash * const info_hash, const ot_peer * const peer, const stuck when there's not enough traffic to fill udp packets fast enough */ void livesync_ticker( ) { - if( ( g_now - livesync_lastpacket_time > LIVESYNC_MAXDELAY) && + if( ( g_now - livesync_lastpacket_time > LIVESYNC_MAXDELAY) && ( livesync_outbuffer_pos > livesync_outbuffer_start + sizeof( g_tracker_id ) ) ) livesync_issuepacket(); } @@ -115,7 +115,7 @@ static void * livesync_worker( void * args ) { uint8_t in_ip[4]; uint16_t in_port; ssize_t datalen; int off; - + args = args; while( 1 ) { diff --git a/ot_livesync.h b/ot_livesync.h index 27070d6..8c3c96d 100644 --- a/ot_livesync.h +++ b/ot_livesync.h @@ -1,6 +1,6 @@ /* This software was written by Dirk Engling It is considered beerware. Prost. Skol. Cheers or whatever. - + $id$ */ #ifndef __OT_LIVESYNC_H__ @@ -24,7 +24,7 @@ 0x001c 0x02 peer's port 0x0020 0x02 peer flags v1 ( SEEDING = 0x80, COMPLETE = 0x40, STOPPED = 0x20 ) ]* - + For N == 24: (aggregator syncs) 0x0000 0x04 id of tracker instance [ 0x0004 0x14 info_hash @@ -34,7 +34,7 @@ 0x0021 0x02 peer flags v1 ( SEEDING = 0x80, COMPLETE = 0x40, STOPPED = 0x20 ) ]+ ]* - + */ @@ -61,7 +61,7 @@ void handle_livesync( const int64 serversocket ); #else -/* If no syncing is required, save calling code from #ifdef +/* If no syncing is required, save calling code from #ifdef constructions */ #define livesync_init() diff --git a/ot_mutex.c b/ot_mutex.c index fb24fe7..a7b583b 100644 --- a/ot_mutex.c +++ b/ot_mutex.c @@ -1,6 +1,6 @@ /* This software was written by Dirk Engling It is considered beerware. Prost. Skol. Cheers or whatever. - + $id$ */ /* System */ @@ -93,7 +93,7 @@ void mutex_bucket_unlock( int bucket ) { bucket_remove( bucket ); pthread_cond_broadcast( &bucket_being_unlocked ); pthread_mutex_unlock( &bucket_mutex ); -} +} void mutex_bucket_unlock_by_hash( ot_hash *hash ) { unsigned char *local_hash = hash[0]; @@ -134,7 +134,7 @@ int mutex_workqueue_pushtask( int64 socket, ot_tasktype tasktype ) { } /* Skip to end of list */ - tmptask = &tasklist; + tmptask = &tasklist; while( *tmptask ) tmptask = &(*tmptask)->next; *tmptask = task; @@ -267,7 +267,7 @@ int mutex_workqueue_pushresult( ot_taskid taskid, int iovec_entries, struct iove MTX_DBG( "pushresult unlocks.\n" ); pthread_mutex_unlock( &tasklist_mutex ); MTX_DBG( "pushresult unlocked.\n" ); - + /* Indicate whether the worker has to throw away results */ return task ? 0 : -1; } @@ -291,7 +291,7 @@ int64 mutex_workqueue_popresult( int *iovec_entries, struct iovec ** iovec ) { *iovec_entries = (*task)->iovec_entries; *iovec = (*task)->iovec; socket = (*task)->socket; - + *task = (*task)->next; free( ptask ); } diff --git a/ot_mutex.h b/ot_mutex.h index 5865765..c05bdfe 100644 --- a/ot_mutex.h +++ b/ot_mutex.h @@ -1,6 +1,6 @@ /* This software was written by Dirk Engling It is considered beerware. Prost. Skol. Cheers or whatever. - + $id$ */ #ifndef __OT_MUTEX_H__ diff --git a/ot_stats.c b/ot_stats.c index 30eb914..5d9dab2 100644 --- a/ot_stats.c +++ b/ot_stats.c @@ -1,6 +1,6 @@ /* This software was written by Dirk Engling It is considered beerware. Prost. Skol. Cheers or whatever. - + $id$ */ /* System */ @@ -85,7 +85,7 @@ static int stats_shift_down_network_count( stats_network_node **node, int depth, int i, rest = 0; if( !*node ) return 0; - if( ++depth == STATS_NETWORK_NODE_MAXDEPTH ) + if( ++depth == STATS_NETWORK_NODE_MAXDEPTH ) for( i=0; icounters[i]>>=shift); return rest; @@ -487,7 +487,7 @@ static size_t stats_torrents_mrtg( char * reply ) static size_t stats_httperrors_txt ( char * reply ) { return sprintf( reply, "302 RED %llu\n400 ... %llu\n400 PAR %llu\n400 COM %llu\n403 IP %llu\n404 INV %llu\n500 SRV %llu\n", - ot_failed_request_counts[0], ot_failed_request_counts[1], ot_failed_request_counts[2], + ot_failed_request_counts[0], ot_failed_request_counts[1], ot_failed_request_counts[2], ot_failed_request_counts[3], ot_failed_request_counts[4], ot_failed_request_counts[5], ot_failed_request_counts[6] ); } @@ -545,10 +545,10 @@ static void stats_make( int *iovec_entries, struct iovec **iovector, ot_tasktype *iovector = NULL; if( !( r = iovec_increase( iovec_entries, iovector, OT_STATS_TMPSIZE ) ) ) return; - + switch( mode & TASK_TASK_MASK ) { case TASK_STATS_TORRENTS: r += stats_torrents_mrtg( r ); break; - case TASK_STATS_PEERS: r += stats_peers_mrtg( r ); break; + case TASK_STATS_PEERS: r += stats_peers_mrtg( r ); break; case TASK_STATS_SLASH24S: r += stats_slash24s_txt( r, 25, 16 ); break; case TASK_STATS_TOP10: r += stats_top10_txt( r ); break; case TASK_STATS_MEMORY: r += stats_vector_usage( r ); break; @@ -609,9 +609,9 @@ void stats_issue_event( ot_status_event event, PROTO_FLAG proto, uint32_t event_ static void * stats_worker( void * args ) { int iovec_entries; struct iovec *iovector; - + args = args; - + while( 1 ) { ot_tasktype tasktype = TASK_STATS; ot_taskid taskid = mutex_workqueue_poptask( &tasktype ); diff --git a/ot_stats.h b/ot_stats.h index 064fb36..a21251b 100644 --- a/ot_stats.h +++ b/ot_stats.h @@ -1,6 +1,6 @@ /* This software was written by Dirk Engling It is considered beerware. Prost. Skol. Cheers or whatever. - + $id$ */ #ifndef __OT_STATS_H__ @@ -30,7 +30,7 @@ enum { CODE_HTTPERROR_403_IP, CODE_HTTPERROR_404, CODE_HTTPERROR_500, - + CODE_HTTPERROR_COUNT }; diff --git a/ot_sync.c b/ot_sync.c index 4beb60d..cd66a46 100644 --- a/ot_sync.c +++ b/ot_sync.c @@ -1,6 +1,6 @@ /* This software was written by Dirk Engling It is considered beerware. Prost. Skol. Cheers or whatever. - + $id$ */ /* System */ diff --git a/ot_sync.h b/ot_sync.h index ae54e67..81d4d22 100644 --- a/ot_sync.h +++ b/ot_sync.h @@ -1,6 +1,6 @@ /* This software was written by Dirk Engling It is considered beerware. Prost. Skol. Cheers or whatever. - + $id$ */ #ifndef __OT_SYNC_H__ diff --git a/ot_udp.c b/ot_udp.c index 1688d69..db8dfbd 100644 --- a/ot_udp.c +++ b/ot_udp.c @@ -1,6 +1,6 @@ /* This software was written by Dirk Engling It is considered beerware. Prost. Skol. Cheers or whatever. - + $id$ */ /* System */ diff --git a/ot_udp.h b/ot_udp.h index 364c9d0..c5f3959 100644 --- a/ot_udp.h +++ b/ot_udp.h @@ -1,6 +1,6 @@ /* This software was written by Dirk Engling It is considered beerware. Prost. Skol. Cheers or whatever. - + $id$ */ #ifndef __OT_UDP_H__ diff --git a/ot_vector.c b/ot_vector.c index e60b27c..0e65d09 100644 --- a/ot_vector.c +++ b/ot_vector.c @@ -1,6 +1,6 @@ /* This software was written by Dirk Engling It is considered beerware. Prost. Skol. Cheers or whatever. - + $id$ */ /* System */ diff --git a/ot_vector.h b/ot_vector.h index ec053fa..32ec26a 100644 --- a/ot_vector.h +++ b/ot_vector.h @@ -1,6 +1,6 @@ /* This software was written by Dirk Engling It is considered beerware. Prost. Skol. Cheers or whatever. - + $id$ */ #ifndef __OT_VECTOR_H__ diff --git a/scan_urlencoded_query.c b/scan_urlencoded_query.c index e84fbfd..2bf957e 100644 --- a/scan_urlencoded_query.c +++ b/scan_urlencoded_query.c @@ -1,6 +1,6 @@ /* This software was written by Dirk Engling It is considered beerware. Prost. Skol. Cheers or whatever. - + $id$ */ #include "scan.h" diff --git a/scan_urlencoded_query.h b/scan_urlencoded_query.h index a253aaa..86ce93e 100644 --- a/scan_urlencoded_query.h +++ b/scan_urlencoded_query.h @@ -1,8 +1,8 @@ /* This software was written by Dirk Engling It is considered beerware. Prost. Skol. Cheers or whatever. - + $id$ */ - + #ifndef __SCAN_URLENCODED_QUERY_H__ #define __SCAN_URLENCODED_QUERY_H__ diff --git a/trackerlogic.c b/trackerlogic.c index 8e33695..3d9ca5e 100644 --- a/trackerlogic.c +++ b/trackerlogic.c @@ -1,6 +1,6 @@ /* This software was written by Dirk Engling It is considered beerware. Prost. Skol. Cheers or whatever. - + $id$ */ /* System */ @@ -277,7 +277,7 @@ size_t remove_peer_from_torrent( ot_hash *hash, ot_peer *peer, char *reply, PROT ot_torrent *torrent = binary_search( hash, torrents_list->data, torrents_list->size, sizeof( ot_torrent ), OT_HASH_COMPARE_SIZE, &exactmatch ); ot_peerlist *peer_list; -#ifdef WANT_SYNC_LIVE +#ifdef WANT_SYNC_LIVE if( proto != FLAG_MCA ) livesync_tell( hash, peer, PEER_FLAG_STOPPED ); #endif @@ -294,7 +294,7 @@ size_t remove_peer_from_torrent( ot_hash *hash, ot_peer *peer, char *reply, PROT ((uint32_t*)reply)[3] = ((uint32_t*)reply)[4] = 0; return (size_t)20; } - + if( proto == FLAG_MCA ) return 0; } @@ -343,7 +343,7 @@ int trackerlogic_init( const char * const serverdir ) { srandom( time(NULL) ); g_tracker_id = random(); - + /* Initialise background worker threads */ mutex_init( ); clean_init( ); diff --git a/trackerlogic.h b/trackerlogic.h index 4461a85..3d7bcb5 100644 --- a/trackerlogic.h +++ b/trackerlogic.h @@ -1,6 +1,6 @@ /* This software was written by Dirk Engling It is considered beerware. Prost. Skol. Cheers or whatever. - + $id$ */ #ifndef __OT_TRACKERLOGIC_H__