diff options
author | Michael Mann <mmann78@netscape.net> | 2017-10-28 11:15:44 -0400 |
---|---|---|
committer | Michael Mann <mmann78@netscape.net> | 2017-10-28 16:00:46 +0000 |
commit | 7df5fcdc51cb2616dc7ec97187e73ab7ecccc7b3 (patch) | |
tree | 4005bf11a9e1d0a369f6df46b95b5d210e54ca0e /ui/gtk | |
parent | 23afd9a18453c23cfbbc6a63f52b2e6e64e0056c (diff) |
Share use of conversation_hash_exact
It was duplicated in GTK, so just make it public (at least for now)
Change-Id: I89d985b2d42f0edb1c535a65a97b132920dedbcd
Reviewed-on: https://code.wireshark.org/review/24146
Petri-Dish: Michael Mann <mmann78@netscape.net>
Tested-by: Petri Dish Buildbot
Reviewed-by: Michael Mann <mmann78@netscape.net>
Diffstat (limited to 'ui/gtk')
-rw-r--r-- | ui/gtk/conversation_hastables_dlg.c | 59 |
1 files changed, 0 insertions, 59 deletions
diff --git a/ui/gtk/conversation_hastables_dlg.c b/ui/gtk/conversation_hastables_dlg.c index 04f8f581dc..c4f9e7cc02 100644 --- a/ui/gtk/conversation_hastables_dlg.c +++ b/ui/gtk/conversation_hastables_dlg.c @@ -40,65 +40,6 @@ static GtkWidget *conversation_hastables_dlg_w = NULL; #define CONV_STR_BUF_MAX 1024 -/* - * Compute the hash value for two given address/port pairs if the match - * is to be exact. - */ -/* http://eternallyconfuzzled.com/tuts/algorithms/jsw_tut_hashing.aspx#existing - * One-at-a-Time hash - */ -static guint -conversation_hash_exact(gconstpointer v) -{ - const conversation_key *key = (const conversation_key *)v; - guint hash_val; - int i; - const guint8 *add_address_to_hash_data; - - hash_val = 0; -#if 0 - hash_val = add_address_to_hash(hash_val, &key->addr1); - hash_val += key->port1; - hash_val = add_address_to_hash(hash_val, &key->addr2); - hash_val += key->port2; - - return hash_val; -#endif - for ( i = 0; i < key->addr1.len; i++ ) { - add_address_to_hash_data = (const guint8 *)((&key->addr1)->data); - hash_val += add_address_to_hash_data[i]; - hash_val += ( hash_val << 10 ); - hash_val ^= ( hash_val >> 6 ); - } - - for ( i = 0; i < 4; i++ ) { - add_address_to_hash_data = (const guint8 *)(&key->port1); - hash_val += add_address_to_hash_data[i]; - hash_val += ( hash_val << 10 ); - hash_val ^= ( hash_val >> 6 ); - } - - for ( i = 0; i < key->addr2.len; i++ ) { - add_address_to_hash_data = (const guint8 *)((&key->addr2)->data); - hash_val += add_address_to_hash_data[i]; - hash_val += ( hash_val << 10 ); - hash_val ^= ( hash_val >> 6 ); - } - - for ( i = 0; i < 4; i++ ) { - add_address_to_hash_data = (const guint8 *)(&key->port2); - hash_val += add_address_to_hash_data[i]; - hash_val += ( hash_val << 10 ); - hash_val ^= ( hash_val >> 6 ); - } - - hash_val += ( hash_val << 3 ); - hash_val ^= ( hash_val >> 11 ); - hash_val += ( hash_val << 15 ); - - return hash_val; -} - static guint conversation_hash_exact_old(gconstpointer v) { |