From: Tom Tromey <tom@tromey.com>
To: gdb-patches@sourceware.org
Cc: Tom Tromey <tom@tromey.com>
Subject: [RFA 2/2] Use gdb::unique_xmalloc_ptr in auto_load_section_scripts
Date: Fri, 09 Feb 2018 12:55:00 -0000 [thread overview]
Message-ID: <20180209125553.7392-3-tom@tromey.com> (raw)
In-Reply-To: <20180209125553.7392-1-tom@tromey.com>
This changes auto_load_section_scripts to use gdb::unique_xmalloc_ptr,
allowing the removal of a cleanup.
2018-02-09 Tom Tromey <tom@tromey.com>
* auto-load.c (auto_load_section_scripts): Use
gdb::unique_xmalloc_ptr.
---
gdb/ChangeLog | 5 +++++
gdb/auto-load.c | 6 ++----
2 files changed, 7 insertions(+), 4 deletions(-)
diff --git a/gdb/ChangeLog b/gdb/ChangeLog
index adc3d19d3b..9e03aa2908 100644
--- a/gdb/ChangeLog
+++ b/gdb/ChangeLog
@@ -1,5 +1,10 @@
2018-02-09 Tom Tromey <tom@tromey.com>
+ * auto-load.c (auto_load_section_scripts): Use
+ gdb::unique_xmalloc_ptr.
+
+2018-02-09 Tom Tromey <tom@tromey.com>
+
* auto-load.c (execute_script_contents): Use std::string.
2018-02-09 Joel Brobecker <brobecker@adacore.com>
diff --git a/gdb/auto-load.c b/gdb/auto-load.c
index 1f3d366a56..b79341faf6 100644
--- a/gdb/auto-load.c
+++ b/gdb/auto-load.c
@@ -1153,13 +1153,11 @@ auto_load_section_scripts (struct objfile *objfile, const char *section_name)
section_name, bfd_get_filename (abfd));
else
{
- struct cleanup *cleanups;
- char *p = (char *) data;
+ gdb::unique_xmalloc_ptr<bfd_byte> data_holder (data);
- cleanups = make_cleanup (xfree, p);
+ char *p = (char *) data;
source_section_scripts (objfile, section_name, p,
p + bfd_get_section_size (scripts_sect));
- do_cleanups (cleanups);
}
}
--
2.13.6
next prev parent reply other threads:[~2018-02-09 12:55 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-02-09 12:55 [RFA 0/2] two more minor cleanup removals Tom Tromey
2018-02-09 12:55 ` Tom Tromey [this message]
2018-02-09 12:56 ` [RFA 1/2] Use std::string in execute_script_contents Tom Tromey
2018-02-09 12:59 ` [RFA 0/2] two more minor cleanup removals Pedro Alves
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20180209125553.7392-3-tom@tromey.com \
--to=tom@tromey.com \
--cc=gdb-patches@sourceware.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox