diff options
author | Peter Wu <peter@lekensteyn.nl> | 2018-11-21 17:08:18 +0100 |
---|---|---|
committer | Michael Mann <mmann78@netscape.net> | 2018-11-22 01:18:21 +0000 |
commit | ad0aecbf8bc3ce0de24f52ae711e184b2fb16c49 (patch) | |
tree | 324376c1a170ff7bc2278cb50efe9f5f0123a857 /ui | |
parent | e7220aad1b6935abb9025e23fa2fdb4936cdaeaf (diff) |
addr_resolv: avoid unnecessary memory allocation for hash tables
The key for the manuf table is 24 bits of the ether addr while the key
for services table needs is a 16 bit port. Store this value directly,
saving some memory and improving startup time by a tiny bit.
Likewise for ipxnet_hash_table and vlan_hash_table. These tables seem
unused though, perhaps it should be removed.
Change-Id: Ide9ffad8e2c9af24afa82adb2e009f32a5f43d38
Reviewed-on: https://code.wireshark.org/review/30756
Petri-Dish: Peter Wu <peter@lekensteyn.nl>
Tested-by: Petri Dish Buildbot
Reviewed-by: Michael Mann <mmann78@netscape.net>
Diffstat (limited to 'ui')
-rw-r--r-- | ui/qt/resolved_addresses_dialog.cpp | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/ui/qt/resolved_addresses_dialog.cpp b/ui/qt/resolved_addresses_dialog.cpp index a27d3ba919..1a20a63768 100644 --- a/ui/qt/resolved_addresses_dialog.cpp +++ b/ui/qt/resolved_addresses_dialog.cpp @@ -95,7 +95,7 @@ serv_port_hash_to_qstringlist(gpointer key, gpointer value, gpointer sl_ptr) { QStringList *string_list = (QStringList *) sl_ptr; serv_port_t *serv_port = (serv_port_t *)value; - int port = *(int*)key; + guint port = GPOINTER_TO_UINT(key); QStringList entries; @@ -125,12 +125,12 @@ manuf_hash_to_qstringlist(gpointer key, gpointer value, gpointer sl_ptr) { QStringList *string_list = (QStringList *) sl_ptr; hashmanuf_t *manuf = (hashmanuf_t*)value; - int eth_as_gint = *(int*)key; + guint eth_as_guint = GPOINTER_TO_UINT(key); QString entry = QString("%1:%2:%3 %4") - .arg((eth_as_gint >> 16 & 0xff), 2, 16, QChar('0')) - .arg((eth_as_gint >> 8 & 0xff), 2, 16, QChar('0')) - .arg((eth_as_gint & 0xff), 2, 16, QChar('0')) + .arg((eth_as_guint >> 16 & 0xff), 2, 16, QChar('0')) + .arg((eth_as_guint >> 8 & 0xff), 2, 16, QChar('0')) + .arg((eth_as_guint & 0xff), 2, 16, QChar('0')) .arg(get_hash_manuf_resolved_name(manuf)); *string_list << entry; |