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>
This commit is contained in:
Michael Mann 2017-01-28 09:34:04 -05:00
parent 120a1ebb22
commit d94d7fc3a0
5 changed files with 10 additions and 19 deletions

View File

@ -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)

View File

@ -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

View File

@ -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);
}

View File

@ -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);
}

View File

@ -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);
}