aboutsummaryrefslogtreecommitdiffstats
path: root/epan/dissectors/packet-fcswils.c
diff options
context:
space:
mode:
authorMichael Mann <mmann78@netscape.net>2017-02-01 23:13:42 -0500
committerMichael Mann <mmann78@netscape.net>2017-02-02 13:46:03 +0000
commit577d21e35c1ca19e245014ea2b65d09709c9cca3 (patch)
tree91d63807f33f05a4970b9fe769dbec7040b904e0 /epan/dissectors/packet-fcswils.c
parent36892d8a4ca2f6019dc00b0f2540097499da2e11 (diff)
GHashtable -> wmem_map conversions
Many of the register_init_routine/register_cleanup_routine functions are for initializing and cleaning up a GHashtable. wmem_map_new_autoreset can do that automatically, so convert many of the simple cases. Change-Id: I93e1f435845fd5a5e5286487e9f0092fae052f3e Reviewed-on: https://code.wireshark.org/review/19912 Petri-Dish: Michael Mann <mmann78@netscape.net> Tested-by: Petri Dish Buildbot <buildbot-no-reply@wireshark.org> Reviewed-by: Dario Lombardo <lomato@gmail.com> Tested-by: Dario Lombardo <lomato@gmail.com> Reviewed-by: Michael Mann <mmann78@netscape.net>
Diffstat (limited to 'epan/dissectors/packet-fcswils.c')
-rw-r--r--epan/dissectors/packet-fcswils.c27
1 files changed, 6 insertions, 21 deletions
diff --git a/epan/dissectors/packet-fcswils.c b/epan/dissectors/packet-fcswils.c
index 22212d2117..3b9256bbc1 100644
--- a/epan/dissectors/packet-fcswils.c
+++ b/epan/dissectors/packet-fcswils.c
@@ -444,7 +444,7 @@ typedef struct _fcswils_conv_data {
guint32 opcode;
} fcswils_conv_data_t;
-static GHashTable *fcswils_req_hash = NULL;
+static wmem_map_t *fcswils_req_hash = NULL;
/* list of commands for each commandset */
typedef void (*fcswils_dissector_t)(tvbuff_t *tvb, packet_info* pinfo, proto_tree *tree, guint8 isreq);
@@ -480,21 +480,6 @@ fcswils_hash(gconstpointer v)
return val;
}
-/*
- * Protocol initialization
- */
-static void
-fcswils_init_protocol(void)
-{
- fcswils_req_hash = g_hash_table_new(fcswils_hash, fcswils_equal);
-}
-
-static void
-fcswils_cleanup_protocol(void)
-{
- g_hash_table_destroy(fcswils_req_hash);
-}
-
static guint8 *
zonenm_to_str(tvbuff_t *tvb, gint offset)
{
@@ -1717,7 +1702,7 @@ dissect_fcswils(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data)
ckey.conv_idx = conversation->conv_index;
- cdata = (fcswils_conv_data_t *)g_hash_table_lookup(fcswils_req_hash,
+ cdata = (fcswils_conv_data_t *)wmem_map_lookup(fcswils_req_hash,
&ckey);
if (cdata) {
/* Since we never free the memory used by an exchange, this maybe a
@@ -1733,7 +1718,7 @@ dissect_fcswils(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data)
cdata = wmem_new(wmem_file_scope(), fcswils_conv_data_t);
cdata->opcode = opcode;
- g_hash_table_insert(fcswils_req_hash, req_key, cdata);
+ wmem_map_insert(fcswils_req_hash, req_key, cdata);
}
}
else {
@@ -1752,7 +1737,7 @@ dissect_fcswils(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data)
else {
ckey.conv_idx = conversation->conv_index;
- cdata = (fcswils_conv_data_t *)g_hash_table_lookup(fcswils_req_hash, &ckey);
+ cdata = (fcswils_conv_data_t *)wmem_map_lookup(fcswils_req_hash, &ckey);
if (cdata != NULL) {
if (opcode == FC_SWILS_SWACC)
@@ -2525,8 +2510,8 @@ proto_register_fcswils(void)
proto_register_subtree_array(ett, array_length(ett));
expert_fcswils = expert_register_protocol(proto_fcswils);
expert_register_field_array(expert_fcswils, ei, array_length(ei));
- register_init_routine(&fcswils_init_protocol);
- register_cleanup_routine(&fcswils_cleanup_protocol);
+
+ fcswils_req_hash = wmem_map_new_autoreset(wmem_epan_scope(), wmem_file_scope(), fcswils_hash, fcswils_equal);
}
void