From: Pedro Alves <palves@redhat.com>
To: Tom Tromey <tom@tromey.com>, gdb-patches@sourceware.org
Subject: Re: [RFA] Fix memory leak in add_symbol_file_command
Date: Mon, 14 Aug 2017 13:51:00 -0000 [thread overview]
Message-ID: <41e0fb1b-2178-4376-4cec-21fe5110e567@redhat.com> (raw)
In-Reply-To: <20170811211846.8455-1-tom@tromey.com>
Looks fine to me. A couple nits.
On 08/11/2017 10:18 PM, Tom Tromey wrote:
> struct section_addr_info *section_addrs;
> - struct sect_opt *sect_opts = NULL;
> - size_t num_sect_opts = 0;
> + std::vector<struct sect_opt> sect_opts;
Drop "struct" throughout in the new code? You're already
dropping it here:
> - for (i = 0; i < section_index; i++)
> + for (sect_opt § : sect_opts)
> @@ -2301,7 +2280,7 @@ add_symbol_file_command (char *args, int from_tty)
> filename, and the second is the address where this file has been
> loaded. Abort now if this address hasn't been provided by the
> user. */
> - if (section_index < 1)
> + if (sect_opts.size () < 1)
> error (_("The address where %s has been loaded is missing"),
> filename.get ());
'if (sect_opts.empty ())' ?
> - for (i = 0; i < section_index; i++)
> + for (sect_opt § : sect_opts)
> {
> CORE_ADDR addr;
> - const char *val = sect_opts[i].value;
> - const char *sec = sect_opts[i].name;
> + const char *val = sect.value;
> + const char *sec = sect.name;
Thanks,
Pedro Alves
next prev parent reply other threads:[~2017-08-14 13:51 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-08-11 21:19 Tom Tromey
2017-08-14 13:51 ` Pedro Alves [this message]
2017-08-14 14:31 ` Tom Tromey
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=41e0fb1b-2178-4376-4cec-21fe5110e567@redhat.com \
--to=palves@redhat.com \
--cc=gdb-patches@sourceware.org \
--cc=tom@tromey.com \
/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