From 0d4569851cf78e2d68a5fc5e60d977cd4f77438a Mon Sep 17 00:00:00 2001 From: Dario Lombardo Date: Mon, 2 May 2016 17:21:57 +0200 Subject: [PATCH] tvbparse: change g_hash_table to wmem_map. Change-Id: I245595051617f6d6333314240825a526adf19339 Reviewed-on: https://code.wireshark.org/review/15244 Reviewed-by: Michael Mann --- epan/tvbparse.c | 8 ++++---- epan/tvbparse.h | 2 +- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/epan/tvbparse.c b/epan/tvbparse.c index 4cd585adf2..b5ce3c87e4 100644 --- a/epan/tvbparse.c +++ b/epan/tvbparse.c @@ -486,7 +486,7 @@ static int cond_hash(tvbparse_t* tt, const int offset, const tvbparse_wanted_t* if (TVBPARSE_DEBUG & TVBPARSE_DEBUG_HASH) g_warning("cond_hash: got key='%s'",key); #endif - if ((value_wanted = (tvbparse_wanted_t *)g_hash_table_lookup(wanted->control.hash.table,key))) { + if ((value_wanted = (tvbparse_wanted_t *)wmem_map_lookup(wanted->control.hash.table,key))) { value_len = value_wanted->condition(tt, offset + key_len, value_wanted, &value_elem); } else if (wanted->control.hash.other) { value_len = wanted->control.hash.other->condition(tt, offset+key_len, wanted->control.hash.other, &value_elem); @@ -527,7 +527,7 @@ tvbparse_wanted_t* tvbparse_hashed(const int id, w->data = data; w->before = before_cb; w->after = after_cb; - w->control.hash.table = g_hash_table_new(g_str_hash,g_str_equal); + w->control.hash.table = wmem_map_new(wmem_epan_scope(), g_str_hash,g_str_equal); w->control.hash.key = key; w->control.hash.other = other; @@ -535,7 +535,7 @@ tvbparse_wanted_t* tvbparse_hashed(const int id, while(( name = va_arg(ap,gchar*) )) { el = va_arg(ap,tvbparse_wanted_t*); - g_hash_table_insert(w->control.hash.table,name,el); + wmem_map_insert(w->control.hash.table,name,el); } va_end(ap); @@ -552,7 +552,7 @@ void tvbparse_hashed_add(tvbparse_wanted_t* w, ...) { while (( name = va_arg(ap,gchar*) )) { el = va_arg(ap,tvbparse_wanted_t*); - g_hash_table_insert(w->control.hash.table,name,el); + wmem_map_insert(w->control.hash.table,name,el); } va_end(ap); diff --git a/epan/tvbparse.h b/epan/tvbparse.h index 2a5386a9bb..6128b8bbca 100644 --- a/epan/tvbparse.h +++ b/epan/tvbparse.h @@ -121,7 +121,7 @@ struct _tvbparse_wanted_t { const tvbparse_wanted_t* subelem; } until; struct { - GHashTable* table; + wmem_map_t* table; struct _tvbparse_wanted_t* key; struct _tvbparse_wanted_t* other; } hash;