diff options
author | Michael Mann <mmann78@netscape.net> | 2017-02-01 23:13:42 -0500 |
---|---|---|
committer | Michael Mann <mmann78@netscape.net> | 2017-02-02 13:46:03 +0000 |
commit | 577d21e35c1ca19e245014ea2b65d09709c9cca3 (patch) | |
tree | 91d63807f33f05a4970b9fe769dbec7040b904e0 /epan/dissectors/packet-rsvp.c | |
parent | 36892d8a4ca2f6019dc00b0f2540097499da2e11 (diff) | |
download | wireshark-577d21e35c1ca19e245014ea2b65d09709c9cca3.tar.gz |
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-rsvp.c')
-rw-r--r-- | epan/dissectors/packet-rsvp.c | 27 |
1 files changed, 4 insertions, 23 deletions
diff --git a/epan/dissectors/packet-rsvp.c b/epan/dissectors/packet-rsvp.c index 1bfc58a09c..e459facee0 100644 --- a/epan/dissectors/packet-rsvp.c +++ b/epan/dissectors/packet-rsvp.c @@ -669,7 +669,7 @@ struct rsvp_request_val { /* * Initialize the conversation related data structures. */ -static GHashTable *rsvp_request_hash = NULL; +static wmem_map_t *rsvp_request_hash = NULL; /* * The list of tree types @@ -1975,23 +1975,6 @@ rsvp_hash(gconstpointer k) return key->conversation; } -/* - * Conversation specific initialization code that deletes any unused memory that - * might need to be freed, and allocates the memory for the various conversation - * hash tables. - */ -static void -rsvp_init_protocol(void) -{ - rsvp_request_hash = g_hash_table_new(rsvp_hash, rsvp_equal); -} - -static void -rsvp_cleanup_protocol(void) -{ - g_hash_table_destroy(rsvp_request_hash); -} - static const char* rsvp_conv_get_filter_type(conv_item_t* conv, conv_filter_type_e filter _U_) { if ((filter == CONV_FT_SRC_ADDRESS) && (conv->src_address.type == AT_IPv4)) @@ -7495,7 +7478,7 @@ dissect_rsvp_common(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, gboolea /* See if a request with this key already exists */ request_val = - (struct rsvp_request_val *) g_hash_table_lookup(rsvp_request_hash, + (struct rsvp_request_val *) wmem_map_lookup(rsvp_request_hash, &request_key); /* If not, insert the new request key into the hash table */ @@ -7531,7 +7514,7 @@ dissect_rsvp_common(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, gboolea request_val = wmem_new(wmem_file_scope(), struct rsvp_request_val); request_val->value = conversation->conv_index; - g_hash_table_insert(rsvp_request_hash, new_request_key, request_val); + wmem_map_insert(rsvp_request_hash, new_request_key, request_val); } tap_queue_packet(rsvp_tap, pinfo, rsvph); @@ -9535,9 +9518,7 @@ proto_register_rsvp(void) expert_register_field_array(expert_rsvp, ei, array_length(ei)); register_rsvp_prefs(); - /* Initialization routine for RSVP conversations */ - register_init_routine(&rsvp_init_protocol); - register_cleanup_routine(&rsvp_cleanup_protocol); + rsvp_request_hash = wmem_map_new_autoreset(wmem_epan_scope(), wmem_file_scope(), rsvp_hash, rsvp_equal); register_conversation_table(proto_rsvp, TRUE, rsvp_conversation_packet, rsvp_hostlist_packet); } |