diff options
author | Michael Mann <mmann78@netscape.net> | 2017-01-28 22:29:32 -0500 |
---|---|---|
committer | Michael Mann <mmann78@netscape.net> | 2017-01-30 02:25:24 +0000 |
commit | 9365fd3d3a4cdac07d70bd77f7a42f3260b33b5e (patch) | |
tree | 934046830769d5f32b51cabd240e3ed40e07a217 /epan/dissectors/packet-pres.c | |
parent | 984d78da13608b7cba3cd8144d1285b33277b0d3 (diff) |
Convert GHashTable -> wmem_map_t for ASN.1 disseectors
Change-Id: Id749c41947c6300f2c82ed947352c336f9e45b72
Reviewed-on: https://code.wireshark.org/review/19838
Petri-Dish: Michael Mann <mmann78@netscape.net>
Tested-by: Petri Dish Buildbot <buildbot-no-reply@wireshark.org>
Reviewed-by: Michael Mann <mmann78@netscape.net>
Diffstat (limited to 'epan/dissectors/packet-pres.c')
-rw-r--r-- | epan/dissectors/packet-pres.c | 33 |
1 files changed, 9 insertions, 24 deletions
diff --git a/epan/dissectors/packet-pres.c b/epan/dissectors/packet-pres.c index 7fcd15060f..bf48babff6 100644 --- a/epan/dissectors/packet-pres.c +++ b/epan/dissectors/packet-pres.c @@ -77,7 +77,7 @@ typedef struct _pres_ctx_oid_t { char *oid; guint32 idx; } pres_ctx_oid_t; -static GHashTable *pres_ctx_oid_table = NULL; +static wmem_map_t *pres_ctx_oid_table = NULL; typedef struct _pres_user_t { guint ctx_id; @@ -247,20 +247,6 @@ pres_ctx_oid_equal(gconstpointer k1, gconstpointer k2) } static void -pres_init(void) -{ - pres_ctx_oid_table = g_hash_table_new(pres_ctx_oid_hash, - pres_ctx_oid_equal); - -} - -static void -pres_cleanup(void) -{ - g_hash_table_destroy(pres_ctx_oid_table); -} - -static void register_ctx_id_and_oid(packet_info *pinfo _U_, guint32 idx, const char *oid) { pres_ctx_oid_t *pco, *tmppco; @@ -283,11 +269,11 @@ register_ctx_id_and_oid(packet_info *pinfo _U_, guint32 idx, const char *oid) } /* if this ctx already exists, remove the old one first */ - tmppco=(pres_ctx_oid_t *)g_hash_table_lookup(pres_ctx_oid_table, pco); + tmppco=(pres_ctx_oid_t *)wmem_map_lookup(pres_ctx_oid_table, pco); if (tmppco) { - g_hash_table_remove(pres_ctx_oid_table, tmppco); + wmem_map_remove(pres_ctx_oid_table, tmppco); } - g_hash_table_insert(pres_ctx_oid_table, pco, pco); + wmem_map_insert(pres_ctx_oid_table, pco, pco); } static char * @@ -323,7 +309,7 @@ find_oid_by_pres_ctx_id(packet_info *pinfo, guint32 idx) pco.idx = 0; } - tmppco=(pres_ctx_oid_t *)g_hash_table_lookup(pres_ctx_oid_table, &pco); + tmppco=(pres_ctx_oid_t *)wmem_map_lookup(pres_ctx_oid_table, &pco); if (tmppco) { return tmppco->oid; } @@ -1359,7 +1345,7 @@ static int dissect_UD_type_PDU(tvbuff_t *tvb _U_, packet_info *pinfo _U_, proto_ /*--- End of included file: packet-pres-fn.c ---*/ -#line 224 "./asn1/pres/packet-pres-template.c" +#line 210 "./asn1/pres/packet-pres-template.c" /* @@ -1841,7 +1827,7 @@ void proto_register_pres(void) { NULL, HFILL }}, /*--- End of included file: packet-pres-hfarr.c ---*/ -#line 393 "./asn1/pres/packet-pres-template.c" +#line 379 "./asn1/pres/packet-pres-template.c" }; /* List of subtrees */ @@ -1888,7 +1874,7 @@ void proto_register_pres(void) { &ett_pres_UD_type, /*--- End of included file: packet-pres-ettarr.c ---*/ -#line 399 "./asn1/pres/packet-pres-template.c" +#line 385 "./asn1/pres/packet-pres-template.c" }; static ei_register_info ei[] = { @@ -1933,8 +1919,7 @@ void proto_register_pres(void) { proto_register_subtree_array(ett, array_length(ett)); expert_pres = expert_register_protocol(proto_pres); expert_register_field_array(expert_pres, ei, array_length(ei)); - register_init_routine(pres_init); - register_cleanup_routine(pres_cleanup); + pres_ctx_oid_table = wmem_map_new_autoreset(wmem_epan_scope(), wmem_file_scope(), pres_ctx_oid_hash, pres_ctx_oid_equal); pres_module = prefs_register_protocol(proto_pres, NULL); |