From cc6ce2d689e59b839627b744f35286f3476649a0 Mon Sep 17 00:00:00 2001 From: William Pitcock Date: Sat, 23 Jan 2016 11:44:08 -0500 Subject: [PATCH] ircd: hash: remove some detritus --- include/hash.h | 4 ---- ircd/hash.c | 63 -------------------------------------------------- 2 files changed, 67 deletions(-) diff --git a/include/hash.h b/include/hash.h index 9d4aca6a..55340e46 100644 --- a/include/hash.h +++ b/include/hash.h @@ -30,8 +30,6 @@ struct Dictionary; struct irc_radixtree; -extern rb_dlink_list *hostTable; - extern struct Dictionary *nd_dict; extern struct irc_radixtree *resv_tree; extern struct irc_radixtree *channel_tree; @@ -106,6 +104,4 @@ struct Client *find_cli_connid_hash(uint32_t connid); void add_to_zconnid_hash(struct Client *client_p); void del_from_zconnid_hash(struct Client *client_p); -extern void hash_stats(struct Client *); - #endif /* INCLUDED_hash_h */ diff --git a/ircd/hash.c b/ircd/hash.c index 88694911..7658536d 100644 --- a/ircd/hash.c +++ b/ircd/hash.c @@ -534,66 +534,3 @@ find_cli_connid_hash(uint32_t connid) return NULL; } - -static void -output_hash(struct Client *source_p, const char *name, int length, int *counts, unsigned long deepest) -{ - unsigned long total = 0; - int i; - char buf[128]; - - sendto_one_numeric(source_p, RPL_STATSDEBUG, - "B :%s Hash Statistics", name); - - snprintf(buf, sizeof buf, "%.3f%%", - (float) ((counts[0]*100) / (float) length)); - sendto_one_numeric(source_p, RPL_STATSDEBUG, - "B :Size: %d Empty: %d (%s)", - length, counts[0], buf); - - for(i = 1; i < 11; i++) - { - total += (counts[i] * i); - } - - /* dont want to divide by 0! --fl */ - if(counts[0] != length) - { - snprintf(buf, sizeof buf, "%.3f/%.3f", - (float) (total / (length - counts[0])), - (float) (total / length)); - sendto_one_numeric(source_p, RPL_STATSDEBUG, - "B :Average depth: %s Highest depth: %lu", - buf, deepest); - } -} - - -static void -count_hash(struct Client *source_p, rb_dlink_list *table, int length, const char *name) -{ - int counts[11]; - unsigned long deepest = 0; - int i; - - memset(counts, 0, sizeof(counts)); - - for(i = 0; i < length; i++) - { - if(rb_dlink_list_length(&table[i]) >= 10) - counts[10]++; - else - counts[rb_dlink_list_length(&table[i])]++; - - if(rb_dlink_list_length(&table[i]) > deepest) - deepest = rb_dlink_list_length(&table[i]); - } - - output_hash(source_p, name, length, counts, deepest); -} - -void -hash_stats(struct Client *source_p) -{ - count_hash(source_p, hostTable, HOST_MAX, "Hostname"); -}