diff options
author | Michael Mann <mmann78@netscape.net> | 2017-01-28 09:34:04 -0500 |
---|---|---|
committer | Michael Mann <mmann78@netscape.net> | 2017-01-28 20:14:12 +0000 |
commit | d94d7fc3a09e1c64349588950e8b644e130b0845 (patch) | |
tree | d500d8336ff7b36cb13dff1b32c5f4761f8f6af0 /epan | |
parent | 120a1ebb2264c7b13cf20a9c8e9db37e9a125743 (diff) | |
download | wireshark-d94d7fc3a09e1c64349588950e8b644e130b0845.tar.gz |
wmem_map_new -> wmem_map_new_autoreset
A few dissectors can benefit from the conversion.
Change-Id: I3b7d54926b79314009e271960aff61870a115390
Reviewed-on: https://code.wireshark.org/review/19826
Reviewed-by: Michael Mann <mmann78@netscape.net>
Diffstat (limited to 'epan')
-rw-r--r-- | epan/dissectors/packet-9p.c | 7 | ||||
-rw-r--r-- | epan/dissectors/packet-hsms.c | 4 | ||||
-rw-r--r-- | epan/dissectors/packet-lapdm.c | 4 | ||||
-rw-r--r-- | epan/dissectors/packet-radius.c | 4 | ||||
-rw-r--r-- | epan/dissectors/packet-rtps.c | 10 |
5 files changed, 10 insertions, 19 deletions
diff --git a/epan/dissectors/packet-9p.c b/epan/dissectors/packet-9p.c index 6b634dde98..2a724062a8 100644 --- a/epan/dissectors/packet-9p.c +++ b/epan/dissectors/packet-9p.c @@ -1021,11 +1021,6 @@ static struct _9p_hashval *_9p_hash_new_val(gsize len) return val; } -static void _9p_hash_init(void) -{ - _9p_hashtable = wmem_map_new(wmem_file_scope(), _9p_hash_hash, _9p_hash_equal); -} - static void _9p_hash_set(packet_info *pinfo, guint16 tag, guint32 fid, struct _9p_hashval *val) { struct _9p_hashkey *key; @@ -2726,7 +2721,7 @@ void proto_register_9P(void) expert_9P = expert_register_protocol(proto_9P); expert_register_field_array(expert_9P, ei, array_length(ei)); - register_init_routine(_9p_hash_init); + _9p_hashtable = wmem_map_new_autoreset(wmem_epan_scope(), wmem_file_scope(), _9p_hash_hash, _9p_hash_equal); } void proto_reg_handoff_9P(void) diff --git a/epan/dissectors/packet-hsms.c b/epan/dissectors/packet-hsms.c index 4403cd6315..ed600e6e04 100644 --- a/epan/dissectors/packet-hsms.c +++ b/epan/dissectors/packet-hsms.c @@ -540,7 +540,7 @@ dissect_hsms(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *data) static void hsms_init(void) { - value_lengths = wmem_map_new(wmem_file_scope(), g_direct_hash, g_direct_equal); + value_lengths = wmem_map_new(wmem_epan_scope(), g_direct_hash, g_direct_equal); wmem_map_insert(value_lengths, GINT_TO_POINTER(FORMAT_CODE_LIST), GINT_TO_POINTER(0)); wmem_map_insert(value_lengths, GINT_TO_POINTER(FORMAT_CODE_BINARY), GINT_TO_POINTER(1)); @@ -756,7 +756,7 @@ proto_register_hsms(void) expert_hsms = expert_register_protocol(proto_hsms); expert_register_field_array(expert_hsms, ei, array_length(ei)); - register_init_routine(&hsms_init); + hsms_init(); } void diff --git a/epan/dissectors/packet-lapdm.c b/epan/dissectors/packet-lapdm.c index d7dc18c950..f1f80976c1 100644 --- a/epan/dissectors/packet-lapdm.c +++ b/epan/dissectors/packet-lapdm.c @@ -206,7 +206,6 @@ lapdm_defragment_init (void) { reassembly_table_init (&lapdm_reassembly_table, &addresses_reassembly_table_functions); - lapdm_last_n_s_map = wmem_map_new(wmem_file_scope(), g_direct_hash, g_direct_equal); } static void @@ -521,6 +520,9 @@ proto_register_lapdm(void) "Reassemble fragmented LAPDm packets", "Whether the dissector should defragment LAPDm messages spanning multiple packets.", &reassemble_lapdm); + + lapdm_last_n_s_map = wmem_map_new_autoreset(wmem_epan_scope(), wmem_file_scope(), g_direct_hash, g_direct_equal); + register_init_routine (lapdm_defragment_init); register_cleanup_routine (lapdm_defragment_cleanup); } diff --git a/epan/dissectors/packet-radius.c b/epan/dissectors/packet-radius.c index ffd3db1679..4c80452949 100644 --- a/epan/dissectors/packet-radius.c +++ b/epan/dissectors/packet-radius.c @@ -2367,8 +2367,6 @@ radius_init_protocol(void) if (! prefs_get_preference_obsolete(alternate_port)) prefs_set_preference_obsolete(alternate_port); } - - radius_calls = wmem_map_new(wmem_file_scope(), radius_call_hash, radius_call_equal); } static void @@ -2658,6 +2656,8 @@ proto_register_radius(void) dict->vendors_by_name = g_hash_table_new(g_str_hash, g_str_equal); dict->tlvs_by_name = g_hash_table_new(g_str_hash, g_str_equal); + radius_calls = wmem_map_new_autoreset(wmem_epan_scope(), wmem_file_scope(), radius_call_hash, radius_call_equal); + register_rtd_table(proto_radius, NULL, RADIUS_CAT_NUM_TIMESTATS, 1, radius_message_code, radiusstat_packet, NULL); } diff --git a/epan/dissectors/packet-rtps.c b/epan/dissectors/packet-rtps.c index 919c36d555..6a372c088f 100644 --- a/epan/dissectors/packet-rtps.c +++ b/epan/dissectors/packet-rtps.c @@ -9526,13 +9526,6 @@ static gboolean dissect_rtps_rtitcp(tvbuff_t *tvb, packet_info *pinfo, proto_tre return dissect_rtps(tvb, pinfo, tree, offset); } -static void -rtps_init(void) -{ - if (enable_topic_info) - registry = wmem_map_new(wmem_file_scope(), hash_by_guid, compare_by_guid); -} - void proto_register_rtps(void) { static hf_register_info hf[] = { @@ -11707,10 +11700,11 @@ void proto_register_rtps(void) { "Enable Topic Information feature", "Shows the Topic Name and Type Name of the samples.", &enable_topic_info); - register_init_routine(rtps_init); rtps_type_name_table = register_dissector_table("rtps.type_name", "RTPS Type Name", proto_rtps, FT_STRING, BASE_NONE); + + registry = wmem_map_new_autoreset(wmem_epan_scope(), wmem_file_scope(), hash_by_guid, compare_by_guid); } |