aboutsummaryrefslogtreecommitdiff
path: root/gdb/target-descriptions.c
diff options
context:
space:
mode:
authorTom Tromey <tom@tromey.com>2019-01-02 08:03:13 -0700
committerTom Tromey <tom@tromey.com>2019-01-02 16:40:11 -0700
commitc55d06ec95961fadd9deeffae519ff0f20f237d3 (patch)
treed29af475537221052acb1202b40769ddf1491a9a /gdb/target-descriptions.c
parent3a6ae42d4e4ecfd2441cf9b978b2a54ad6767cb7 (diff)
downloadgdb-c55d06ec95961fadd9deeffae519ff0f20f237d3.zip
gdb-c55d06ec95961fadd9deeffae519ff0f20f237d3.tar.gz
gdb-c55d06ec95961fadd9deeffae519ff0f20f237d3.tar.bz2
Remove a cleanup from target-descriptions.c
This removes a cleanup from target-descriptions.c, by changing it to use a unique_ptr instead. Note that a deletion adapter is used, even though target_desc is allocated with new, to avoid moving target_desc to target-descriptions.h. gdb/ChangeLog 2019-01-02 Tom Tromey <tom@tromey.com> * xml-tdesc.c (xml_cache): Hold a target_desc_up. (tdesc_parse_xml): Remove cleanups. * target-descriptions.h (make_cleanup_free_target_description): Don't declare. (target_desc_deleter): New struct. (target_desc_up): New typedef. * target-descriptions.c (target_desc_deleter::operator()): Rename from free_target_description. (make_cleanup_free_target_description): Remove.
Diffstat (limited to 'gdb/target-descriptions.c')
-rw-r--r--gdb/target-descriptions.c12
1 files changed, 2 insertions, 10 deletions
diff --git a/gdb/target-descriptions.c b/gdb/target-descriptions.c
index efea97e..f04b8fc 100644
--- a/gdb/target-descriptions.c
+++ b/gdb/target-descriptions.c
@@ -1138,20 +1138,12 @@ allocate_target_description (void)
return new target_desc ();
}
-static void
-free_target_description (void *arg)
+void
+target_desc_deleter::operator() (struct target_desc *target_desc) const
{
- struct target_desc *target_desc = (struct target_desc *) arg;
-
delete target_desc;
}
-struct cleanup *
-make_cleanup_free_target_description (struct target_desc *target_desc)
-{
- return make_cleanup (free_target_description, target_desc);
-}
-
void
tdesc_add_compatible (struct target_desc *target_desc,
const struct bfd_arch_info *compatible)