From a58bce83ad91fa264a79c9a9acc9358bb2aa5661 Mon Sep 17 00:00:00 2001 From: erdgeist <> Date: Thu, 12 Mar 2009 22:53:30 +0000 Subject: Found some minor issues in busy network detection code. --- ot_stats.c | 14 ++++++-------- 1 file changed, 6 insertions(+), 8 deletions(-) (limited to 'ot_stats.c') diff --git a/ot_stats.c b/ot_stats.c index 23a3a37..e1bce7c 100644 --- a/ot_stats.c +++ b/ot_stats.c @@ -76,7 +76,7 @@ static stats_network_node *stats_network_counters_root = NULL; static int stat_increase_network_count( stats_network_node **node, int depth, uintptr_t ip ) { uint8_t *_ip = (uint8_t*)ip; - int foo = _ip[++depth]; + int foo = _ip[depth]; if( !*node ) { *node = malloc( sizeof( stats_network_node ) ); @@ -86,7 +86,7 @@ static int stat_increase_network_count( stats_network_node **node, int depth, ui } if( depth < STATS_NETWORK_NODE_MAXDEPTH ) - return stat_increase_network_count( &(*node)->children[ foo ], depth, ip ); + return stat_increase_network_count( &(*node)->children[ foo ], depth+1, ip ); (*node)->counters[ foo ]++; return 0; @@ -125,16 +125,11 @@ static void stats_get_highscore_networks( stats_network_node *node, int depth, o if( !node ) return; - if( !depth++ ) { - memset( scores, 0, sizeof( *scores ) * network_count ); - memset( networks, 0, sizeof( *networks ) * network_count ); - } - if( depth < STATS_NETWORK_NODE_MAXDEPTH ) { for( i=0; ichildren[i] ) { _node_value[depth] = i; - stats_get_highscore_networks( node->children[i], depth, node_value, scores, networks, network_count ); + stats_get_highscore_networks( node->children[i], depth+1, node_value, scores, networks, network_count ); } } else for( i=0; i=0; --i) { -- cgit v1.2.3