aboutsummaryrefslogtreecommitdiffstats
path: root/epan/dissectors/packet-gsm_sms.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-gsm_sms.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-gsm_sms.c')
-rw-r--r--epan/dissectors/packet-gsm_sms.c26
1 files changed, 6 insertions, 20 deletions
diff --git a/epan/dissectors/packet-gsm_sms.c b/epan/dissectors/packet-gsm_sms.c
index 57cb6c5212..0298fa2431 100644
--- a/epan/dissectors/packet-gsm_sms.c
+++ b/epan/dissectors/packet-gsm_sms.c
@@ -289,7 +289,7 @@ static value_string_ext gsm_sms_coding_group_bits_vals_ext = VALUE_STRING_EXT_IN
static dissector_table_t gsm_sms_dissector_tbl;
/* Short Message reassembly */
static reassembly_table g_sm_reassembly_table;
-static GHashTable *g_sm_fragment_params_table = NULL;
+static wmem_map_t *g_sm_fragment_params_table = NULL;
static gint ett_gsm_sms_ud_fragment = -1;
static gint ett_gsm_sms_ud_fragments = -1;
/*
@@ -335,18 +335,6 @@ typedef struct {
guint8 fill_bits;
} sm_fragment_params;
-static void
-gsm_sms_defragment_init (void)
-{
- g_sm_fragment_params_table = g_hash_table_new(g_direct_hash, g_direct_equal);
-}
-
-static void
-gsm_sms_defragment_cleanup (void)
-{
- g_hash_table_destroy(g_sm_fragment_params_table);
-}
-
/*
* this is the GSM 03.40 definition with the bit 2
* set to 1 for uplink messages
@@ -1906,7 +1894,7 @@ dis_field_ud(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, guint32 offset
p_frag_params->udl = udl;
p_frag_params->fill_bits = fill_bits;
p_frag_params->length = length;
- g_hash_table_insert(g_sm_fragment_params_table,
+ wmem_map_insert(g_sm_fragment_params_table,
GUINT_TO_POINTER((guint)((udh_fields.sm_id<<16)|(udh_fields.frag-1))),
p_frag_params);
} /* Else: not fragmented */
@@ -1950,7 +1938,7 @@ dis_field_ud(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, guint32 offset
total_sms_len = 0;
for(i = 0 ; i < udh_fields.frags; i++)
{
- p_frag_params = (sm_fragment_params*)g_hash_table_lookup(g_sm_fragment_params_table,
+ p_frag_params = (sm_fragment_params*)wmem_map_lookup(g_sm_fragment_params_table,
GUINT_TO_POINTER((guint)((udh_fields.sm_id<<16)|i)));
if (p_frag_params) {
@@ -1978,7 +1966,7 @@ dis_field_ud(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, guint32 offset
total_sms_len = 0;
for(i = 0 ; i < udh_fields.frags; i++)
{
- p_frag_params = (sm_fragment_params*)g_hash_table_lookup(g_sm_fragment_params_table,
+ p_frag_params = (sm_fragment_params*)wmem_map_lookup(g_sm_fragment_params_table,
GUINT_TO_POINTER((guint)((udh_fields.sm_id<<16)|i)));
if (p_frag_params) {
@@ -2023,7 +2011,7 @@ dis_field_ud(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, guint32 offset
total_sms_len = 0;
for(i = 0 ; i < udh_fields.frags; i++)
{
- p_frag_params = (sm_fragment_params*)g_hash_table_lookup(g_sm_fragment_params_table,
+ p_frag_params = (sm_fragment_params*)wmem_map_lookup(g_sm_fragment_params_table,
GUINT_TO_POINTER((guint)((udh_fields.sm_id<<16)|i)));
if (p_frag_params) {
@@ -3357,9 +3345,7 @@ proto_register_gsm_sms(void)
register_dissector("gsm_sms", dissect_gsm_sms, proto_gsm_sms);
- /* GSM SMS UD dissector initialization routines */
- register_init_routine (gsm_sms_defragment_init);
- register_cleanup_routine (gsm_sms_defragment_cleanup);
+ g_sm_fragment_params_table = wmem_map_new_autoreset(wmem_epan_scope(), wmem_file_scope(), g_direct_hash, g_direct_equal);
reassembly_table_register(&g_sm_reassembly_table,
&addresses_reassembly_table_functions);