aboutsummaryrefslogtreecommitdiff
path: root/gdb/osdata.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/osdata.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/osdata.c')
-rw-r--r--gdb/osdata.c22
1 files changed, 10 insertions, 12 deletions
diff --git a/gdb/osdata.c b/gdb/osdata.c
index 9802b03..88190e2 100644
--- a/gdb/osdata.c
+++ b/gdb/osdata.c
@@ -168,23 +168,21 @@ const struct gdb_xml_element osdata_elements[] = {
struct osdata *
osdata_parse (const char *xml)
{
- struct gdb_xml_parser *parser;
- struct cleanup *before_deleting_result, *back_to;
+ struct cleanup *back_to;
struct osdata_parsing_data data = { NULL };
- back_to = make_cleanup (null_cleanup, NULL);
- parser = gdb_xml_create_parser_and_cleanup (_("osdata"),
- osdata_elements, &data);
- gdb_xml_use_dtd (parser, "osdata.dtd");
+ back_to = make_cleanup (clear_parsing_data, &data);
- before_deleting_result = make_cleanup (clear_parsing_data, &data);
-
- if (gdb_xml_parse (parser, xml) == 0)
- /* Parsed successfully, don't need to delete the result. */
- discard_cleanups (before_deleting_result);
+ if (gdb_xml_parse_quick (_("osdata"), "osdata.dtd",
+ osdata_elements, xml, &data) == 0)
+ {
+ /* Parsed successfully, don't need to delete the result. */
+ discard_cleanups (back_to);
+ return data.osdata;
+ }
do_cleanups (back_to);
- return data.osdata;
+ return NULL;
}
#endif