aboutsummaryrefslogtreecommitdiffstats
path: root/epan/dissectors/packet-fcfzs.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-fcfzs.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-fcfzs.c')
-rw-r--r--epan/dissectors/packet-fcfzs.c26
1 files changed, 5 insertions, 21 deletions
diff --git a/epan/dissectors/packet-fcfzs.c b/epan/dissectors/packet-fcfzs.c
index 6dba52aeb6..3e518769e1 100644
--- a/epan/dissectors/packet-fcfzs.c
+++ b/epan/dissectors/packet-fcfzs.c
@@ -81,7 +81,7 @@ typedef struct _fcfzs_conv_data {
guint32 opcode;
} fcfzs_conv_data_t;
-static GHashTable *fcfzs_req_hash = NULL;
+static wmem_map_t *fcfzs_req_hash = NULL;
/*
* Hash Functions
@@ -106,21 +106,6 @@ fcfzs_hash(gconstpointer v)
return val;
}
-/*
- * Protocol initialization
- */
-static void
-fcfzs_init_protocol(void)
-{
- fcfzs_req_hash = g_hash_table_new(fcfzs_hash, fcfzs_equal);
-}
-
-static void
-fcfzs_cleanup_protocol(void)
-{
- g_hash_table_destroy(fcfzs_req_hash);
-}
-
/* Code to actually dissect the packets */
static void
dissect_fcfzs_zoneset(tvbuff_t *tvb, packet_info* pinfo, proto_tree *tree, int offset)
@@ -561,7 +546,7 @@ dissect_fcfzs(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data)
ckey.conv_idx = conversation->conv_index;
- cdata = (fcfzs_conv_data_t *)g_hash_table_lookup(fcfzs_req_hash,
+ cdata = (fcfzs_conv_data_t *)wmem_map_lookup(fcfzs_req_hash,
&ckey);
if (cdata) {
/* Since we never free the memory used by an exchange, this maybe a
@@ -577,7 +562,7 @@ dissect_fcfzs(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data)
cdata = wmem_new(wmem_file_scope(), fcfzs_conv_data_t);
cdata->opcode = opcode;
- g_hash_table_insert(fcfzs_req_hash, req_key, cdata);
+ wmem_map_insert(fcfzs_req_hash, req_key, cdata);
}
col_add_str(pinfo->cinfo, COL_INFO, val_to_str(opcode, fc_fzs_opcode_val,
@@ -603,7 +588,7 @@ dissect_fcfzs(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data)
else {
ckey.conv_idx = conversation->conv_index;
- cdata = (fcfzs_conv_data_t *)g_hash_table_lookup(fcfzs_req_hash, &ckey);
+ cdata = (fcfzs_conv_data_t *)wmem_map_lookup(fcfzs_req_hash, &ckey);
if (cdata != NULL) {
if (opcode == FCCT_MSG_ACC)
@@ -867,9 +852,8 @@ proto_register_fcfzs(void)
proto_register_subtree_array(ett, array_length(ett));
expert_fcfzs = expert_register_protocol(proto_fcfzs);
expert_register_field_array(expert_fcfzs, ei, array_length(ei));
- register_init_routine(&fcfzs_init_protocol);
- register_cleanup_routine(&fcfzs_cleanup_protocol);
+ fcfzs_req_hash = wmem_map_new_autoreset(wmem_epan_scope(), wmem_file_scope(), fcfzs_hash, fcfzs_equal);
}
void