aboutsummaryrefslogtreecommitdiff
path: root/gdb/xml-support.h
diff options
context:
space:
mode:
authorPedro Alves <palves@redhat.com>2017-04-18 21:39:25 +0100
committerPedro Alves <palves@redhat.com>2017-04-18 23:51:33 +0100
commit4895cde29761f6c39fdb6c319ff4666ee39f5d28 (patch)
tree914cf7101c112ebe0ba12b904518dfae9aa77327 /gdb/xml-support.h
parentbd8a901f9e34191e0645a5527556d124ba5c345a (diff)
downloadgdb-4895cde29761f6c39fdb6c319ff4666ee39f5d28.zip
gdb-4895cde29761f6c39fdb6c319ff4666ee39f5d28.tar.gz
gdb-4895cde29761f6c39fdb6c319ff4666ee39f5d28.tar.bz2
gdb_xml_parser: make data fields private and make more functions methods
This patch makes the data fields of gdb_xml_parser private, and makes more functions be gdb_xml_parser methods. This is mostly for better encapsulation. Some free functions have their parsing-related guts converted to methods, while the free functions remain, as they're used as expat callbacks. Now their only job is to be small shims that restore back the gdb_xml_parser type, defer work to the corresponding method, and make sure C++ exceptions don't cross expat. More C++-fycation of the XML parsers built on top of gdb_xml_parser could follow, but this was my stopping point. gdb/ChangeLog: 2017-04-18 Pedro Alves <palves@redhat.com> * xml-support.c (gdb_xml_parser) <use_dtd, dtd_name, parse, vdebug, verror, body_text, start_element, end_element, name, user_data, set_is_xinclude, set_error, expat_parser>: New methods. <name, user_data, expat_parser, scopes, error, last_line, dtd_name, is_xinclude>: Make private and add m_ prefix. (gdb_xml_parser::body_text): New method, based on ... (gdb_xml_body_text): ... this. Adjust. (gdb_xml_parser::vdebug): New method, based on ... (gdb_xml_debug): ... this. Adjust. (gdb_xml_parser::verror): New method, based on ... (gdb_xml_error): ... this. Adjust. (gdb_xml_parser::start_element): New method, based on ... (gdb_xml_start_element): ... this. Adjust. (gdb_xml_start_element_wrapper): Defer to gdb_xml_parser::start_element and gdb_xml_parser::set_error. (gdb_xml_parser::end_element): New method, based on ... (gdb_xml_end_element_wrapper): ... this. Adjust. (gdb_xml_parser::~gdb_xml_parser): Adjust. (gdb_xml_parser::gdb_xml_parser): Adjust to field renames. (gdb_xml_parser::use_dtd): New method, based on ... (gdb_xml_use_dtd): ... this. Adjust. (gdb_xml_parser::parse): New method, based on ... (gdb_xml_parse): ... this. Adjust. (gdb_xml_parse_quick): Adjust to call the parser's parse method. (xinclude_start_include): Adjust to call the parser's name method. (xml_xinclude_default, xml_xinclude_start_doctype) (xml_xinclude_end_doctype): Adjust to call the parser's user_data method. (xml_process_xincludes): Adjust to call parser methods. * xml-support.h (gdb_xml_use_dtd, gdb_xml_parse): Delete declarations.
Diffstat (limited to 'gdb/xml-support.h')
-rw-r--r--gdb/xml-support.h14
1 files changed, 0 insertions, 14 deletions
diff --git a/gdb/xml-support.h b/gdb/xml-support.h
index 8248a32..f9ea64d 100644
--- a/gdb/xml-support.h
+++ b/gdb/xml-support.h
@@ -172,20 +172,6 @@ struct gdb_xml_element
gdb_xml_element_end_handler *end_handler;
};
-/* Associate DTD_NAME, which must be the name of a compiled-in DTD,
- with PARSER. */
-
-void gdb_xml_use_dtd (struct gdb_xml_parser *parser, const char *dtd_name);
-
-/* Invoke PARSER on BUFFER. BUFFER is the data to parse, which
- should be NUL-terminated.
-
- The return value is 0 for success or -1 for error. It may throw,
- but only if something unexpected goes wrong during parsing; parse
- errors will be caught, warned about, and reported as failure. */
-
-int gdb_xml_parse (struct gdb_xml_parser *parser, const char *buffer);
-
/* Parse a XML document. DOCUMENT is the data to parse, which should
be NUL-terminated. If non-NULL, use the compiled-in DTD named
DTD_NAME to drive the parsing.