diff options
author | Pedro Alves <palves@redhat.com> | 2011-02-02 16:12:59 +0000 |
---|---|---|
committer | Pedro Alves <palves@redhat.com> | 2011-02-02 16:12:59 +0000 |
commit | 3d2c1d41d4b6cdaa6052ddfd99b0745cc70c9cbb (patch) | |
tree | addbf54d22e8398af15ff23704ed86fd84b94bd8 /gdb/xml-support.c | |
parent | 0af3e2db57c384891ab4f6905ea619930d953ae6 (diff) | |
download | gdb-3d2c1d41d4b6cdaa6052ddfd99b0745cc70c9cbb.zip gdb-3d2c1d41d4b6cdaa6052ddfd99b0745cc70c9cbb.tar.gz gdb-3d2c1d41d4b6cdaa6052ddfd99b0745cc70c9cbb.tar.bz2 |
* 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.
Diffstat (limited to 'gdb/xml-support.c')
-rw-r--r-- | gdb/xml-support.c | 18 |
1 files changed, 17 insertions, 1 deletions
diff --git a/gdb/xml-support.c b/gdb/xml-support.c index 0bcb975..e0ac8de 100644 --- a/gdb/xml-support.c +++ b/gdb/xml-support.c @@ -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; |