* xml-support.c (xml_find_attribute): New.
(xinclude_start_include): Use it. * xml-support.h (xml_find_attribute): Declare. * memory-map.c (memory_map_start_memory) (memory_map_start_property): Use xml_find_attribute. * osdata.c (osdata_start_osdata, osdata_start_column): Use xml_find_attribute. * remote.c (start_thread): Use xml_find_attribute. * solib-target.c (library_list_start_segment) (library_list_start_section, library_list_start_library) (library_list_start_list): Use xml_find_attribute. * xml-tdesc.c (tdesc_start_target, tdesc_start_feature) (tdesc_start_union, tdesc_start_struct, tdesc_start_flags) (tdesc_start_field): Use xml_find_attribute.
This commit is contained in:
parent
0af3e2db57
commit
3d2c1d41d4
8 changed files with 76 additions and 35 deletions
|
@ -138,6 +138,22 @@ gdb_xml_error (struct gdb_xml_parser *parser, const char *format, ...)
|
|||
throw_verror (XML_PARSE_ERROR, format, ap);
|
||||
}
|
||||
|
||||
/* Find the attribute named NAME in the set of parsed attributes
|
||||
ATTRIBUTES. Returns NULL if not found. */
|
||||
|
||||
struct gdb_xml_value *
|
||||
xml_find_attribute (VEC(gdb_xml_value_s) *attributes, const char *name)
|
||||
{
|
||||
struct gdb_xml_value *value;
|
||||
int ix;
|
||||
|
||||
for (ix = 0; VEC_iterate (gdb_xml_value_s, attributes, ix, value); ix++)
|
||||
if (strcmp (value->name, name) == 0)
|
||||
return value;
|
||||
|
||||
return NULL;
|
||||
}
|
||||
|
||||
/* Clean up a vector of parsed attribute values. */
|
||||
|
||||
static void
|
||||
|
@ -758,7 +774,7 @@ xinclude_start_include (struct gdb_xml_parser *parser,
|
|||
void *user_data, VEC(gdb_xml_value_s) *attributes)
|
||||
{
|
||||
struct xinclude_parsing_data *data = user_data;
|
||||
char *href = VEC_index (gdb_xml_value_s, attributes, 0)->value;
|
||||
char *href = xml_find_attribute (attributes, "href")->value;
|
||||
struct cleanup *back_to;
|
||||
char *text, *output;
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue