aboutsummaryrefslogtreecommitdiffstats
path: root/epan/dissectors/asn1/acse
diff options
context:
space:
mode:
authorMichael Mann <mmann78@netscape.net>2017-01-28 22:29:32 -0500
committerMichael Mann <mmann78@netscape.net>2017-01-30 02:25:24 +0000
commit9365fd3d3a4cdac07d70bd77f7a42f3260b33b5e (patch)
tree934046830769d5f32b51cabd240e3ed40e07a217 /epan/dissectors/asn1/acse
parent984d78da13608b7cba3cd8144d1285b33277b0d3 (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/asn1/acse')
-rw-r--r--epan/dissectors/asn1/acse/packet-acse-template.c27
1 files changed, 10 insertions, 17 deletions
diff --git a/epan/dissectors/asn1/acse/packet-acse-template.c b/epan/dissectors/asn1/acse/packet-acse-template.c
index f783b87061..02adb4e98e 100644
--- a/epan/dissectors/asn1/acse/packet-acse-template.c
+++ b/epan/dissectors/asn1/acse/packet-acse-template.c
@@ -90,7 +90,7 @@ typedef struct _acse_ctx_oid_t {
guint32 ctx_id;
char *oid;
} acse_ctx_oid_t;
-static GHashTable *acse_ctx_oid_table = NULL;
+static wmem_map_t *acse_ctx_oid_table = NULL;
static guint
acse_ctx_oid_hash(gconstpointer k)
@@ -108,18 +108,6 @@ acse_ctx_oid_equal(gconstpointer k1, gconstpointer k2)
}
static void
-acse_init(void)
-{
- if (acse_ctx_oid_table) {
- g_hash_table_destroy(acse_ctx_oid_table);
- acse_ctx_oid_table = NULL;
- }
- acse_ctx_oid_table = g_hash_table_new(acse_ctx_oid_hash,
- acse_ctx_oid_equal);
-
-}
-
-static void
register_ctx_id_and_oid(packet_info *pinfo _U_, guint32 idx, char *oid)
{
acse_ctx_oid_t *aco, *tmpaco;
@@ -128,18 +116,18 @@ register_ctx_id_and_oid(packet_info *pinfo _U_, guint32 idx, char *oid)
aco->oid=wmem_strdup(wmem_file_scope(), oid);
/* if this ctx already exists, remove the old one first */
- tmpaco=(acse_ctx_oid_t *)g_hash_table_lookup(acse_ctx_oid_table, aco);
+ tmpaco=(acse_ctx_oid_t *)wmem_map_lookup(acse_ctx_oid_table, aco);
if (tmpaco) {
- g_hash_table_remove(acse_ctx_oid_table, tmpaco);
+ wmem_map_remove(acse_ctx_oid_table, tmpaco);
}
- g_hash_table_insert(acse_ctx_oid_table, aco, aco);
+ wmem_map_insert(acse_ctx_oid_table, aco, aco);
}
static char *
find_oid_by_ctx_id(packet_info *pinfo _U_, guint32 idx)
{
acse_ctx_oid_t aco, *tmpaco;
aco.ctx_id=idx;
- tmpaco=(acse_ctx_oid_t *)g_hash_table_lookup(acse_ctx_oid_table, &aco);
+ tmpaco=(acse_ctx_oid_t *)wmem_map_lookup(acse_ctx_oid_table, &aco);
if (tmpaco) {
return tmpaco->oid;
}
@@ -294,6 +282,11 @@ void proto_register_acse(void) {
proto_register_subtree_array(ett, array_length(ett));
expert_acse = expert_register_protocol(proto_acse);
expert_register_field_array(expert_acse, ei, array_length(ei));
+
+#if NOT_NEEDED
+ acse_ctx_oid_table = wmem_map_new_autoreset(wmem_epan_scope(), wmem_file_scope(), acse_ctx_oid_hash,
+ acse_ctx_oid_equal);
+#endif
}