C++-ify gdb/xml-support.c a bit to eliminate cleanups
authorPedro Alves <palves@redhat.com>
Tue, 18 Apr 2017 20:39:24 +0000 (21:39 +0100)
committerPedro Alves <palves@redhat.com>
Tue, 18 Apr 2017 20:39:24 +0000 (21:39 +0100)
commit010151c9146eb2a299686e41c714e57c344be8e8
tree3f6be3d2165cf4e9e48aab03fae858bdff72cd7a
parentd56060f08aa4ed5786042a066f62aa8e474cc0fd
C++-ify gdb/xml-support.c a bit to eliminate cleanups

Basically convert cleanups to destructors in gdb_xml_parser and
xinclude_parsing_data, and then allocate objects of those types on the
stack.

More C++-ification is possible / will follow, but this removes a few
make_cleanup calls already.

gdb/ChangeLog:
2017-04-18  Pedro Alves  <palves@redhat.com>

* xml-support.c (gdb_xml_parser): Add ctor/dtor.  Make is_xinclude
a bool.
(gdb_xml_end_element): Change type of first parameter.
(gdb_xml_cleanup): Rename to ...
(gdb_xml_parser::~gdb_xml_parser): ... this.
(gdb_xml_create_parser_and_cleanup): Delete with ...
(gdb_xml_parser::gdb_xml_parser): ... creation parts factored out
to this new ctor.
(gdb_xml_parse_quick): Create a local gdb_xml_parser instead of
using gdb_xml_create_parser_and_cleanup.
(xinclude_parsing_data): Add ctor/dtor.
(xml_xinclude_cleanup): Delete.
(xml_process_xincludes): Create a local xinclude_parsing_data
instead of heap-allocating one.  Create a local gdb_xml_parser
instead of heap-allocating one with
gdb_xml_create_parser_and_cleanup.
gdb/ChangeLog
gdb/xml-support.c