From 36892d8a4ca2f6019dc00b0f2540097499da2e11 Mon Sep 17 00:00:00 2001 From: Dario Lombardo Date: Wed, 1 Feb 2017 14:29:30 +0100 Subject: [PATCH] iso15765: convert GHashTable to wmem_map. Change-Id: I25fd598f3c2bd75548213140e93198b611f30d4b Reviewed-on: https://code.wireshark.org/review/19900 Reviewed-by: Michael Mann Petri-Dish: Dario Lombardo Tested-by: Petri Dish Buildbot Reviewed-by: Dario Lombardo --- epan/dissectors/packet-iso15765.c | 23 +++++------------------ 1 file changed, 5 insertions(+), 18 deletions(-) diff --git a/epan/dissectors/packet-iso15765.c b/epan/dissectors/packet-iso15765.c index d20d2e318b..3d033d0c36 100644 --- a/epan/dissectors/packet-iso15765.c +++ b/epan/dissectors/packet-iso15765.c @@ -124,7 +124,7 @@ static int proto_iso15765 = -1; static dissector_table_t subdissector_table; static reassembly_table iso15765_reassembly_table; -static GHashTable *iso15765_frame_table = NULL; +static wmem_map_t *iso15765_frame_table = NULL; static int hf_iso15765_fragments = -1; static int hf_iso15765_fragment = -1; @@ -249,7 +249,7 @@ dissect_iso15765(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data iso15765_frame->seq = iso15765_info->seq = ++msg_seqid; iso15765_frame->len = full_len; - g_hash_table_insert(iso15765_frame_table, GUINT_TO_POINTER(iso15765_info->seq), iso15765_frame); + wmem_map_insert(iso15765_frame_table, GUINT_TO_POINTER(iso15765_info->seq), iso15765_frame); } /* Show some info */ @@ -308,7 +308,7 @@ dissect_iso15765(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data guint16 frag_id = frag_id_low; /* Get frame information */ - iso15765_frame = (iso15765_frame_t *) g_hash_table_lookup(iso15765_frame_table, + iso15765_frame = (iso15765_frame_t *)wmem_map_lookup(iso15765_frame_table, GUINT_TO_POINTER(iso15765_info->seq)); if (iso15765_frame != NULL) @@ -382,19 +382,6 @@ dissect_iso15765(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data return tvb_captured_length(tvb); } -static void -iso15765_init(void) -{ - iso15765_frame_table = g_hash_table_new(g_direct_hash, g_direct_equal); -} - -static void -iso15765_cleanup(void) -{ - reassembly_table_destroy(&iso15765_reassembly_table); -} - - void proto_register_iso15765(void) { @@ -616,8 +603,8 @@ proto_register_iso15765(void) register_decode_as(&can_iso15765); - register_init_routine(iso15765_init); - register_cleanup_routine(iso15765_cleanup); + iso15765_frame_table = wmem_map_new_autoreset(wmem_epan_scope(), wmem_file_scope(), g_direct_hash, g_direct_equal); + reassembly_table_register(&iso15765_reassembly_table, &addresses_reassembly_table_functions); }