tvbparse: change g_hash_table to wmem_map.

Change-Id: I245595051617f6d6333314240825a526adf19339
Reviewed-on: https://code.wireshark.org/review/15244
Reviewed-by: Michael Mann <mmann78@netscape.net>
This commit is contained in:
Dario Lombardo 2016-05-02 17:21:57 +02:00 committed by Michael Mann
parent a7ab65df89
commit 0d4569851c
2 changed files with 5 additions and 5 deletions

View File

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

View File

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