diff options
-rw-r--r-- | epan/dissectors/packet-xml.c | 190 | ||||
-rw-r--r-- | epan/dissectors/packet-xml.h | 6 |
2 files changed, 87 insertions, 109 deletions
diff --git a/epan/dissectors/packet-xml.c b/epan/dissectors/packet-xml.c index bb7a5d7f46..0d671624fa 100644 --- a/epan/dissectors/packet-xml.c +++ b/epan/dissectors/packet-xml.c @@ -74,8 +74,8 @@ static tvbparse_wanted_t *want; static tvbparse_wanted_t *want_ignore; static tvbparse_wanted_t *want_heur; -static GHashTable *xmpli_names; -static GHashTable *media_types; +static wmem_map_t *xmpli_names; +static wmem_map_t *media_types; static xml_ns_t xml_ns = {"xml", "/", -1, -1, -1, NULL, NULL, NULL}; static xml_ns_t unknown_ns = {"unknown", "?", -1, -1, -1, NULL, NULL, NULL}; @@ -187,7 +187,7 @@ dissect_xml(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data _U_) g_ptr_array_free(stack, TRUE); stack = g_ptr_array_new(); - current_frame = (xml_frame_t *)wmem_alloc(wmem_packet_scope(), sizeof(xml_frame_t)); + current_frame = wmem_new(wmem_packet_scope(), xml_frame_t); current_frame->type = XML_FRAME_ROOT; current_frame->name = NULL; current_frame->name_orig_case = NULL; @@ -203,7 +203,7 @@ dissect_xml(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data _U_) root_ns = NULL; if (pinfo->match_string) - root_ns = (xml_ns_t *)g_hash_table_lookup(media_types, pinfo->match_string); + root_ns = (xml_ns_t *)wmem_map_lookup(media_types, pinfo->match_string); if (! root_ns ) { root_ns = &xml_ns; @@ -327,7 +327,7 @@ static void after_token(void *tvbparse_data, const void *wanted_data _U_, tvbpar tvb_format_text(tok->tvb, tok->offset, tok->len)); if (is_cdata) { - new_frame = (xml_frame_t *)wmem_alloc(wmem_packet_scope(), sizeof(xml_frame_t)); + new_frame = wmem_new(wmem_packet_scope(), xml_frame_t); new_frame->type = XML_FRAME_CDATA; new_frame->name = NULL; new_frame->name_orig_case = NULL; @@ -351,7 +351,7 @@ static void before_xmpli(void *tvbparse_data, const void *wanted_data _U_, tvbpa proto_tree *pt; tvbparse_elem_t *name_tok = tok->sub->next; gchar *name = tvb_get_string_enc(wmem_packet_scope(), name_tok->tvb, name_tok->offset, name_tok->len, ENC_ASCII); - xml_ns_t *ns = (xml_ns_t *)g_hash_table_lookup(xmpli_names, name); + xml_ns_t *ns = (xml_ns_t *)wmem_map_lookup(xmpli_names, name); xml_frame_t *new_frame; int hf_tag; @@ -372,7 +372,7 @@ static void before_xmpli(void *tvbparse_data, const void *wanted_data _U_, tvbpa pt = proto_item_add_subtree(pi, ett); - new_frame = (xml_frame_t *)wmem_alloc(wmem_packet_scope(), sizeof(xml_frame_t)); + new_frame = wmem_new(wmem_packet_scope(), xml_frame_t); new_frame->type = XML_FRAME_XMPLI; new_frame->name = name; new_frame->name_orig_case = name; @@ -426,10 +426,10 @@ static void before_tag(void *tvbparse_data, const void *wanted_data _U_, tvbpars name = (gchar *)tvb_get_string_enc(wmem_packet_scope(), leaf_tok->tvb, leaf_tok->offset, leaf_tok->len, ENC_ASCII); name_orig_case = name; - nameroot_ns = (xml_ns_t *)g_hash_table_lookup(xml_ns.elements, root_name); + nameroot_ns = (xml_ns_t *)wmem_map_lookup(xml_ns.elements, root_name); if(nameroot_ns) { - ns = (xml_ns_t *)g_hash_table_lookup(nameroot_ns->elements, name); + ns = (xml_ns_t *)wmem_map_lookup(nameroot_ns->elements, name); if (!ns) { ns = &unknown_ns; } @@ -443,10 +443,10 @@ static void before_tag(void *tvbparse_data, const void *wanted_data _U_, tvbpars ascii_strdown_inplace(name); if(current_frame->ns) { - ns = (xml_ns_t *)g_hash_table_lookup(current_frame->ns->elements, name); + ns = (xml_ns_t *)wmem_map_lookup(current_frame->ns->elements, name); if (!ns) { - if (! ( ns = (xml_ns_t *)g_hash_table_lookup(root_ns->elements, name) ) ) { + if (! ( ns = (xml_ns_t *)wmem_map_lookup(root_ns->elements, name) ) ) { ns = &unknown_ns; } } @@ -462,7 +462,7 @@ static void before_tag(void *tvbparse_data, const void *wanted_data _U_, tvbpars pt = proto_item_add_subtree(pi, ns->ett); - new_frame = (xml_frame_t *)wmem_alloc(wmem_packet_scope(), sizeof(xml_frame_t)); + new_frame = wmem_new(wmem_packet_scope(), xml_frame_t); new_frame->type = XML_FRAME_TAG; new_frame->name = name; new_frame->name_orig_case = name_orig_case; @@ -533,7 +533,7 @@ static void before_dtd_doctype(void *tvbparse_data, const void *wanted_data _U_, proto_item_set_text(dtd_item, "%s", tvb_format_text(tok->tvb, tok->offset, tok->len)); - new_frame = (xml_frame_t *)wmem_alloc(wmem_packet_scope(), sizeof(xml_frame_t)); + new_frame = wmem_new(wmem_packet_scope(), xml_frame_t); new_frame->type = XML_FRAME_DTD_DOCTYPE; new_frame->name = (gchar *)tvb_get_string_enc(wmem_packet_scope(), name_tok->tvb, name_tok->offset, @@ -600,7 +600,7 @@ static void after_attrib(void *tvbparse_data, const void *wanted_data _U_, tvbpa name_orig_case = wmem_strdup(wmem_packet_scope(), name); ascii_strdown_inplace(name); - if(current_frame->ns && (hfidp = (int *)g_hash_table_lookup(current_frame->ns->attributes, name) )) { + if(current_frame->ns && (hfidp = (int *)wmem_map_lookup(current_frame->ns->attributes, name) )) { hfid = *hfidp; value = value_part; } else { @@ -613,7 +613,7 @@ static void after_attrib(void *tvbparse_data, const void *wanted_data _U_, tvbpa current_frame->last_item = pi; - new_frame = (xml_frame_t *)wmem_alloc(wmem_packet_scope(), sizeof(xml_frame_t)); + new_frame = wmem_new(wmem_packet_scope(), xml_frame_t); new_frame->type = XML_FRAME_ATTRIB; new_frame->name = name; new_frame->name_orig_case = name_orig_case; @@ -793,30 +793,30 @@ static void init_xml_parser(void) } -static xml_ns_t *xml_new_namespace(GHashTable *hash, const gchar *name, ...) +static xml_ns_t *xml_new_namespace(wmem_map_t *hash, const gchar *name, ...) { - xml_ns_t *ns = (xml_ns_t *)g_malloc(sizeof(xml_ns_t)); + xml_ns_t *ns = wmem_new(wmem_epan_scope(), xml_ns_t); va_list ap; gchar *attr_name; - ns->name = g_strdup(name); + ns->name = wmem_strdup(wmem_epan_scope(), name); ns->hf_tag = -1; ns->hf_cdata = -1; ns->ett = -1; - ns->attributes = g_hash_table_new(g_str_hash, g_str_equal); - ns->elements = g_hash_table_new(g_str_hash, g_str_equal); + ns->attributes = wmem_map_new(wmem_epan_scope(), g_str_hash, g_str_equal); + ns->elements = NULL; va_start(ap, name); while(( attr_name = va_arg(ap, gchar *) )) { - int *hfp = (int *)g_malloc(sizeof(int)); + int *hfp = wmem_new(wmem_epan_scope(), int); *hfp = -1; - g_hash_table_insert(ns->attributes, g_strdup(attr_name), hfp); + wmem_map_insert(ns->attributes, wmem_strdup(wmem_epan_scope(), attr_name), hfp); }; va_end(ap); - g_hash_table_insert(hash, ns->name, ns); + wmem_map_insert(hash, ns->name, ns); return ns; } @@ -862,7 +862,7 @@ static void add_xmlpi_namespace(gpointer k _U_, gpointer v, gpointer p) d.basename = basename; d.hf = hf_arr; - g_hash_table_foreach(ns->attributes, add_xml_attribute_names, &d); + wmem_map_foreach(ns->attributes, add_xml_attribute_names, &d); } @@ -896,35 +896,35 @@ static void destroy_dtd_data(dtd_build_data_t *dtd_data) static void copy_attrib_item(gpointer k, gpointer v _U_, gpointer p) { - gchar *key = (gchar *)g_strdup((const gchar *)k); - int *value = (int *)g_malloc(sizeof(int)); - GHashTable *dst = (GHashTable *)p; + gchar *key = (gchar *)wmem_strdup(wmem_epan_scope(), (const gchar *)k); + int *value = wmem_new(wmem_epan_scope(), int); + wmem_map_t *dst = (wmem_map_t *)p; *value = -1; - g_hash_table_insert(dst, key, value); + wmem_map_insert(dst, key, value); } -static GHashTable *copy_attributes_hash(GHashTable *src) +static wmem_map_t *copy_attributes_hash(wmem_map_t *src) { - GHashTable *dst = g_hash_table_new(g_str_hash, g_str_equal); + wmem_map_t *dst = wmem_map_new(wmem_epan_scope(), g_str_hash, g_str_equal); - g_hash_table_foreach(src, copy_attrib_item, dst); + wmem_map_foreach(src, copy_attrib_item, dst); return dst; } static xml_ns_t *duplicate_element(xml_ns_t *orig) { - xml_ns_t *new_item = (xml_ns_t *)g_malloc(sizeof(xml_ns_t)); + xml_ns_t *new_item = wmem_new(wmem_epan_scope(), xml_ns_t); guint i; - new_item->name = g_strdup(orig->name); + new_item->name = wmem_strdup(wmem_epan_scope(), orig->name); new_item->hf_tag = -1; new_item->hf_cdata = -1; new_item->ett = -1; new_item->attributes = copy_attributes_hash(orig->attributes); - new_item->elements = g_hash_table_new(g_str_hash, g_str_equal); + new_item->elements = wmem_map_new(wmem_epan_scope(), g_str_hash, g_str_equal); new_item->element_names = g_ptr_array_new(); for(i=0; i < orig->element_names->len; i++) { @@ -938,23 +938,23 @@ static xml_ns_t *duplicate_element(xml_ns_t *orig) static gchar *fully_qualified_name(GPtrArray *hier, gchar *name, gchar *proto_name) { guint i; - GString *s = g_string_new(proto_name); + wmem_strbuf_t *s = wmem_strbuf_new(wmem_epan_scope(), proto_name); - g_string_append(s, "."); + wmem_strbuf_append(s, "."); for (i = 1; i < hier->len; i++) { - g_string_append_printf(s, "%s.", (gchar *)g_ptr_array_index(hier, i)); + wmem_strbuf_append_printf(s, "%s.", (gchar *)g_ptr_array_index(hier, i)); } - g_string_append(s, name); + wmem_strbuf_append(s, name); - return g_string_free(s, FALSE); + return wmem_strbuf_finalize(s);; } static xml_ns_t *make_xml_hier(gchar *elem_name, xml_ns_t *root, - GHashTable *elements, + wmem_map_t *elements, GPtrArray *hier, GString *error, wmem_array_t *hfs, @@ -973,7 +973,7 @@ static xml_ns_t *make_xml_hier(gchar *elem_name, return NULL; } - if (! ( orig = (xml_ns_t *)g_hash_table_lookup(elements, elem_name) )) { + if (! ( orig = (xml_ns_t *)wmem_map_lookup(elements, elem_name) )) { g_string_append_printf(error, "element '%s' is not defined\n", elem_name); return NULL; } @@ -1002,7 +1002,7 @@ static xml_ns_t *make_xml_hier(gchar *elem_name, d.basename = fqn; d.hf = hfs; - g_hash_table_foreach(fresh->attributes, add_xml_attribute_names, &d); + wmem_map_foreach(fresh->attributes, add_xml_attribute_names, &d); while(fresh->element_names->len) { gchar *child_name = (gchar *)g_ptr_array_remove_index(fresh->element_names, 0); @@ -1013,7 +1013,7 @@ static xml_ns_t *make_xml_hier(gchar *elem_name, g_ptr_array_remove_index_fast(hier, hier->len - 1); if (child_element) { - g_hash_table_insert(fresh->elements, child_element->name, child_element); + wmem_map_insert(fresh->elements, child_element->name, child_element); } } @@ -1022,35 +1022,20 @@ static xml_ns_t *make_xml_hier(gchar *elem_name, return fresh; } -static gboolean free_both(gpointer k, gpointer v, gpointer p _U_) -{ - g_free(k); - g_free(v); - return TRUE; -} - -static gboolean free_elements(gpointer k _U_, gpointer v, gpointer p _U_) +static void free_elements(gpointer k _U_, gpointer v, gpointer p _U_) { xml_ns_t *e = (xml_ns_t *)v; - g_free(e->name); - g_hash_table_foreach_remove(e->attributes, free_both, NULL); - g_hash_table_destroy(e->attributes); - g_hash_table_destroy(e->elements); - while (e->element_names->len) { g_free(g_ptr_array_remove_index(e->element_names, 0)); } g_ptr_array_free(e->element_names, TRUE); - g_free(e); - - return TRUE; } static void register_dtd(dtd_build_data_t *dtd_data, GString *errors) { - GHashTable *elements = g_hash_table_new(g_str_hash, g_str_equal); + wmem_map_t *elements = wmem_map_new(wmem_epan_scope(), g_str_hash, g_str_equal); gchar *root_name = NULL; xml_ns_t *root_element = NULL; wmem_array_t *hfs; @@ -1062,25 +1047,25 @@ static void register_dtd(dtd_build_data_t *dtd_data, GString *errors) /* we first populate elements with the those coming from the parser */ while(dtd_data->elements->len) { dtd_named_list_t *nl = (dtd_named_list_t *)g_ptr_array_remove_index(dtd_data->elements, 0); - xml_ns_t *element = (xml_ns_t *)g_malloc(sizeof(xml_ns_t)); + xml_ns_t *element = wmem_new(wmem_epan_scope(), xml_ns_t); /* we will use the first element found as root in case no other one was given. */ if (root_name == NULL) - root_name = g_strdup(nl->name); + root_name = wmem_strdup(wmem_epan_scope(), nl->name); element->name = nl->name; element->element_names = nl->list; element->hf_tag = -1; element->hf_cdata = -1; element->ett = -1; - element->attributes = g_hash_table_new(g_str_hash, g_str_equal); - element->elements = g_hash_table_new(g_str_hash, g_str_equal); + element->attributes = wmem_map_new(wmem_epan_scope(), g_str_hash, g_str_equal); + element->elements = wmem_map_new(wmem_epan_scope(), g_str_hash, g_str_equal); - if( g_hash_table_lookup(elements, element->name) ) { + if( wmem_map_lookup(elements, element->name) ) { g_string_append_printf(errors, "element %s defined more than once\n", element->name); free_elements(NULL, element, NULL); } else { - g_hash_table_insert(elements, (gpointer)element->name, element); + wmem_map_insert(elements, element->name, element); g_ptr_array_add(element_names, wmem_strdup(wmem_epan_scope(), element->name)); } @@ -1090,15 +1075,15 @@ static void register_dtd(dtd_build_data_t *dtd_data, GString *errors) /* then we add the attributes to its relative elements */ while(dtd_data->attributes->len) { dtd_named_list_t *nl = (dtd_named_list_t *)g_ptr_array_remove_index(dtd_data->attributes, 0); - xml_ns_t *element = (xml_ns_t *)g_hash_table_lookup(elements, nl->name); + xml_ns_t *element = (xml_ns_t *)wmem_map_lookup(elements, nl->name); if (element) { while(nl->list->len) { gchar *name = (gchar *)g_ptr_array_remove_index(nl->list, 0); - int *id_p = (int *)g_malloc(sizeof(int)); + int *id_p = wmem_new(wmem_epan_scope(), int); *id_p = -1; - g_hash_table_insert(element->attributes, name, id_p); + wmem_map_insert(element->attributes, name, id_p); } } else { @@ -1112,8 +1097,8 @@ static void register_dtd(dtd_build_data_t *dtd_data, GString *errors) /* if a proto_root is defined in the dtd we'll use that as root */ if( dtd_data->proto_root ) { - g_free(root_name); - root_name = g_strdup(dtd_data->proto_root); + wmem_free(wmem_epan_scope(), root_name); + root_name = wmem_strdup(wmem_epan_scope(), dtd_data->proto_root); } /* we use a stack with the names to avoid recurring infinitelly */ @@ -1137,13 +1122,13 @@ static void register_dtd(dtd_build_data_t *dtd_data, GString *errors) } /* the root element of the dtd's namespace */ - root_element = (xml_ns_t *)g_malloc(sizeof(xml_ns_t)); - root_element->name = g_strdup(root_name); + root_element = wmem_new(wmem_epan_scope(), xml_ns_t); + root_element->name = wmem_strdup(wmem_epan_scope(), root_name); root_element->fqn = dtd_data->proto_name ? g_strdup(dtd_data->proto_name) : root_element->name; root_element->hf_tag = -1; root_element->hf_cdata = -1; root_element->ett = -1; - root_element->elements = g_hash_table_new(g_str_hash, g_str_equal); + root_element->elements = wmem_map_new(wmem_epan_scope(), g_str_hash, g_str_equal); root_element->element_names = element_names; /* @@ -1156,9 +1141,9 @@ static void register_dtd(dtd_build_data_t *dtd_data, GString *errors) make_xml_hier(root_name, root_element, elements, hier, errors, hfs, etts, dtd_data->proto_name); - g_hash_table_insert(root_element->elements, (gpointer)root_element->name, root_element); + wmem_map_insert(root_element->elements, (gpointer)root_element->name, root_element); - orig_root = (xml_ns_t *)g_hash_table_lookup(elements, root_name); + orig_root = (xml_ns_t *)wmem_map_lookup(elements, root_name); /* if the root element was defined copy its attrlist to the child */ if(orig_root) { @@ -1168,9 +1153,9 @@ static void register_dtd(dtd_build_data_t *dtd_data, GString *errors) d.hf = hfs; root_element->attributes = copy_attributes_hash(orig_root->attributes); - g_hash_table_foreach(root_element->attributes, add_xml_attribute_names, &d); + wmem_map_foreach(root_element->attributes, add_xml_attribute_names, &d); } else { - root_element->attributes = g_hash_table_new(g_str_hash, g_str_equal); + root_element->attributes = wmem_map_new(wmem_epan_scope(), g_str_hash, g_str_equal); } /* we then create all the sub hierarchies to catch the recurred cases */ @@ -1179,10 +1164,10 @@ static void register_dtd(dtd_build_data_t *dtd_data, GString *errors) while(root_element->element_names->len) { curr_name = (gchar *)g_ptr_array_remove_index(root_element->element_names, 0); - if( ! g_hash_table_lookup(root_element->elements, curr_name) ) { + if( ! wmem_map_lookup(root_element->elements, curr_name) ) { xml_ns_t *fresh = make_xml_hier(curr_name, root_element, elements, hier, errors, hfs, etts, dtd_data->proto_name); - g_hash_table_insert(root_element->elements, (gpointer)fresh->name, fresh); + wmem_map_insert(root_element->elements, (gpointer)fresh->name, fresh); } } @@ -1190,7 +1175,7 @@ static void register_dtd(dtd_build_data_t *dtd_data, GString *errors) /* a flat namespace */ g_ptr_array_add(hier, root_name); - root_element->attributes = g_hash_table_new(g_str_hash, g_str_equal); + root_element->attributes = wmem_map_new(wmem_epan_scope(), g_str_hash, g_str_equal); while(root_element->element_names->len) { xml_ns_t *fresh; @@ -1198,7 +1183,7 @@ static void register_dtd(dtd_build_data_t *dtd_data, GString *errors) struct _attr_reg_data d; curr_name = (gchar *)g_ptr_array_remove_index(root_element->element_names, 0); - fresh = duplicate_element((xml_ns_t *)g_hash_table_lookup(elements, curr_name)); + fresh = duplicate_element((xml_ns_t *)wmem_map_lookup(elements, curr_name)); fresh->fqn = fully_qualified_name(hier, curr_name, root_name); add_xml_field(hfs, &(fresh->hf_tag), curr_name, fresh->fqn); @@ -1207,14 +1192,14 @@ static void register_dtd(dtd_build_data_t *dtd_data, GString *errors) d.basename = fresh->fqn; d.hf = hfs; - g_hash_table_foreach(fresh->attributes, add_xml_attribute_names, &d); + wmem_map_foreach(fresh->attributes, add_xml_attribute_names, &d); ett_p = &fresh->ett; g_array_append_val(etts, ett_p); g_ptr_array_free(fresh->element_names, TRUE); - g_hash_table_insert(root_element->elements, (gpointer)fresh->name, fresh); + wmem_map_insert(root_element->elements, (gpointer)fresh->name, fresh); } } @@ -1247,20 +1232,18 @@ static void register_dtd(dtd_build_data_t *dtd_data, GString *errors) proto_register_subtree_array((gint **)g_array_data(etts), etts->len); if (dtd_data->media_type) { - g_hash_table_insert(media_types, dtd_data->media_type, root_element); + wmem_map_insert(media_types, dtd_data->media_type, root_element); dtd_data->media_type = NULL; } g_array_free(etts, TRUE); } - g_hash_table_insert(xml_ns.elements, (gpointer)root_element->name, root_element); - - g_hash_table_foreach_remove(elements, free_elements, NULL); - g_hash_table_destroy(elements); + wmem_map_insert(xml_ns.elements, root_element->name, root_element); + wmem_map_foreach(elements, free_elements, NULL); destroy_dtd_data(dtd_data); - g_free(root_name); + wmem_free(wmem_epan_scope(), root_name); } # define DIRECTORY_T GDir @@ -1272,27 +1255,22 @@ static void register_dtd(dtd_build_data_t *dtd_data, GString *errors) static void init_xml_names(void) { - xml_ns_t *xmlpi_xml_ns; guint i; DIRECTORY_T *dir; const FILE_T *file; const gchar *filename; gchar *dirname; - GError **dummy = (GError **)g_malloc(sizeof(GError *)); + GError **dummy = wmem_new(wmem_epan_scope(), GError *); *dummy = NULL; - xmpli_names = g_hash_table_new(g_str_hash, g_str_equal); - media_types = g_hash_table_new(g_str_hash, g_str_equal); - - unknown_ns.elements = xml_ns.elements = g_hash_table_new(g_str_hash, g_str_equal); - unknown_ns.attributes = xml_ns.attributes = g_hash_table_new(g_str_hash, g_str_equal); - - xmlpi_xml_ns = xml_new_namespace(xmpli_names, "xml", "version", "encoding", "standalone", NULL); + xmpli_names = wmem_map_new(wmem_epan_scope(), g_str_hash, g_str_equal); + media_types = wmem_map_new(wmem_epan_scope(), g_str_hash, g_str_equal); - g_hash_table_destroy(xmlpi_xml_ns->elements); - xmlpi_xml_ns->elements = NULL; + unknown_ns.elements = xml_ns.elements = wmem_map_new(wmem_epan_scope(), g_str_hash, g_str_equal); + unknown_ns.attributes = xml_ns.attributes = wmem_map_new(wmem_epan_scope(), g_str_hash, g_str_equal); + xml_new_namespace(xmpli_names, "xml", "version", "encoding", "standalone", NULL); dirname = get_persconffile_path("dtds", FALSE); @@ -1353,14 +1331,14 @@ static void init_xml_names(void) g_free(dirname); for(i=0;i<array_length(default_media_types);i++) { - if( ! g_hash_table_lookup(media_types, default_media_types[i]) ) { - g_hash_table_insert(media_types, (gpointer)default_media_types[i], &xml_ns); + if( ! wmem_map_lookup(media_types, default_media_types[i]) ) { + wmem_map_insert(media_types, (gpointer)default_media_types[i], &xml_ns); } } - g_hash_table_foreach(xmpli_names, add_xmlpi_namespace, (gpointer)"xml.xmlpi"); + wmem_map_foreach(xmpli_names, add_xmlpi_namespace, (gpointer)"xml.xmlpi"); - g_free(dummy); + wmem_free(wmem_epan_scope(), dummy); } void @@ -1470,7 +1448,7 @@ add_dissector_media(gpointer k, gpointer v _U_, gpointer p _U_) void proto_reg_handoff_xml(void) { - g_hash_table_foreach(media_types, add_dissector_media, NULL); + wmem_map_foreach(media_types, add_dissector_media, NULL); dissector_add_uint_range_with_preference("tcp.port", "", xml_handle); heur_dissector_add("http", dissect_xml_heur, "XML in HTTP", "xml_http", xml_ns.hf_tag, HEURISTIC_DISABLE); diff --git a/epan/dissectors/packet-xml.h b/epan/dissectors/packet-xml.h index d0c5487e15..a9dba1fe17 100644 --- a/epan/dissectors/packet-xml.h +++ b/epan/dissectors/packet-xml.h @@ -40,13 +40,13 @@ typedef struct _xml_ns_t { /* the subtree for its sub items */ gint ett; - GHashTable* attributes; + wmem_map_t* attributes; /* key: the attribute name value: hf_id of what's between quotes */ /* the namespace's namespaces */ - GHashTable* elements; - /* key: the element name + wmem_map_t* elements; + /* key: the element name value: the child namespace */ GPtrArray* element_names; |