aboutsummaryrefslogtreecommitdiff
path: root/gdb/solib-target.c
diff options
context:
space:
mode:
authorPedro Alves <palves@redhat.com>2011-01-25 09:49:59 +0000
committerPedro Alves <palves@redhat.com>2011-01-25 09:49:59 +0000
commitefc0eabd6019406ff92286a36713d41a42515e09 (patch)
treeba00441bc43cc80496e16e09e2e9ae366e2079dd /gdb/solib-target.c
parentf30f86fa955570721c2c0c95468d975f216bf754 (diff)
downloadgdb-efc0eabd6019406ff92286a36713d41a42515e09.zip
gdb-efc0eabd6019406ff92286a36713d41a42515e09.tar.gz
gdb-efc0eabd6019406ff92286a36713d41a42515e09.tar.bz2
Simplify XML parsing a bit.
* xml-support.h (gdb_xml_parse_quick): Declare. * xml-support.c (gdb_xml_create_parser_and_cleanup_1): Renamed from gdb_xml_create_parser_and_cleanup, and added `old_chain' parameter. (gdb_xml_create_parser_and_cleanup): Reimplement on top of gdb_xml_create_parser_and_cleanup_1. (gdb_xml_parse_quick): New. * memory-map.c (parse_memory_map): Use gdb_xml_parse_quick. * osdata.c (osdata_parse): Ditto. * remote.c (remote_threads_info): Ditto. * solib-target.c (solib_target_parse_libraries): Ditto. * xml-syscall.c (syscall_parse_xml): Ditto. * xml-tdesc.c (tdesc_parse_xml): Ditto.
Diffstat (limited to 'gdb/solib-target.c')
-rw-r--r--gdb/solib-target.c24
1 files changed, 10 insertions, 14 deletions
diff --git a/gdb/solib-target.c b/gdb/solib-target.c
index 403d3c0..a3f5982 100644
--- a/gdb/solib-target.c
+++ b/gdb/solib-target.c
@@ -227,24 +227,20 @@ const struct gdb_xml_element library_list_elements[] = {
static VEC(lm_info_p) *
solib_target_parse_libraries (const char *library)
{
- struct gdb_xml_parser *parser;
VEC(lm_info_p) *result = NULL;
- struct cleanup *before_deleting_result, *back_to;
+ struct cleanup *back_to = make_cleanup (solib_target_free_library_list,
+ &result);
- back_to = make_cleanup (null_cleanup, NULL);
- parser = gdb_xml_create_parser_and_cleanup (_("target library list"),
- library_list_elements, &result);
- gdb_xml_use_dtd (parser, "library-list.dtd");
-
- before_deleting_result = make_cleanup (solib_target_free_library_list,
- &result);
-
- if (gdb_xml_parse (parser, library) == 0)
- /* Parsed successfully, don't need to delete the result. */
- discard_cleanups (before_deleting_result);
+ if (gdb_xml_parse_quick (_("target library list"), "library-list.dtd",
+ library_list_elements, library, &result) == 0)
+ {
+ /* Parsed successfully, keep the result. */
+ discard_cleanups (back_to);
+ return result;
+ }
do_cleanups (back_to);
- return result;
+ return NULL;
}
#endif