From efc0eabd6019406ff92286a36713d41a42515e09 Mon Sep 17 00:00:00 2001 From: Pedro Alves Date: Tue, 25 Jan 2011 09:49:59 +0000 Subject: 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. --- gdb/remote.c | 21 +++++---------------- 1 file changed, 5 insertions(+), 16 deletions(-) (limited to 'gdb/remote.c') diff --git a/gdb/remote.c b/gdb/remote.c index 528e22f..48d9d55 100644 --- a/gdb/remote.c +++ b/gdb/remote.c @@ -2595,25 +2595,16 @@ remote_threads_info (struct target_ops *ops) TARGET_OBJECT_THREADS, NULL); struct cleanup *back_to = make_cleanup (xfree, xml); + if (xml && *xml) { - struct gdb_xml_parser *parser; struct threads_parsing_context context; - struct cleanup *clear_parsing_context; - - context.items = 0; - /* Note: this parser cleanup is already guarded by BACK_TO - above. */ - parser = gdb_xml_create_parser_and_cleanup (_("threads"), - threads_elements, - &context); - gdb_xml_use_dtd (parser, "threads.dtd"); + context.items = NULL; + make_cleanup (clear_threads_parsing_context, &context); - clear_parsing_context - = make_cleanup (clear_threads_parsing_context, &context); - - if (gdb_xml_parse (parser, xml) == 0) + if (gdb_xml_parse_quick (_("threads"), "threads.dtd", + threads_elements, xml, &context) == 0) { int i; struct thread_item *item; @@ -2640,8 +2631,6 @@ remote_threads_info (struct target_ops *ops) } } } - - do_cleanups (clear_parsing_context); } do_cleanups (back_to); -- cgit v1.1