From: Simon Marchi <simon.marchi@polymtl.ca>
To: Tom Tromey <tom@tromey.com>
Cc: gdb-patches@sourceware.org
Subject: Re: [RFA] Remove a cleanup from call_function_by_hand_dummy
Date: Sat, 17 Feb 2018 19:23:00 -0000 [thread overview]
Message-ID: <bc14a7c64b3f1d90bdea0d14734bed23@polymtl.ca> (raw)
In-Reply-To: <20180217161104.4909-1-tom@tromey.com>
On 2018-02-17 11:11, Tom Tromey wrote:
> This removes a cleanup from call_function_by_hand_dummy, replacing
> manual allocation with std::vector.
>
> Regression tested by the buildbot.
>
> gdb/ChangeLog
> 2018-02-16 Tom Tromey <tom@tromey.com>
>
> * infcall.c (call_function_by_hand_dummy): Use std::vector.
> ---
> gdb/ChangeLog | 4 ++++
> gdb/infcall.c | 14 ++++----------
> 2 files changed, 8 insertions(+), 10 deletions(-)
>
> diff --git a/gdb/infcall.c b/gdb/infcall.c
> index 8b75297251..6ff725a815 100644
> --- a/gdb/infcall.c
> +++ b/gdb/infcall.c
> @@ -732,7 +732,6 @@ call_function_by_hand_dummy (struct value
> *function,
> struct type *ftype = check_typedef (value_type (function));
> CORE_ADDR bp_addr;
> struct frame_id dummy_id;
> - struct cleanup *args_cleanup;
> struct frame_info *frame;
> struct gdbarch *gdbarch;
> struct cleanup *terminate_bp_cleanup;
> @@ -1054,21 +1053,18 @@ call_function_by_hand_dummy (struct value
> *function,
> }
> }
>
> + std::vector<struct value *> new_args;
> if (hidden_first_param_p)
> {
> - struct value **new_args;
> -
> /* Add the new argument to the front of the argument list. */
> - new_args = XNEWVEC (struct value *, nargs + 1);
> + new_args.reserve (nargs + 1);
This should probably be resize instead of reserve. When you call
reserve, it doesn't change the actual length of the vector. You could
then use a def_vector to avoid unneeded zero-initialization by the
resize operation.
Other than that, LGTM.
Simon
next prev parent reply other threads:[~2018-02-17 19:23 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-02-17 16:11 Tom Tromey
2018-02-17 19:23 ` Simon Marchi [this message]
2018-02-17 20:47 ` Tom Tromey
2018-02-21 3:54 ` Tom Tromey
2018-02-21 13:04 ` Simon Marchi
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=bc14a7c64b3f1d90bdea0d14734bed23@polymtl.ca \
--to=simon.marchi@polymtl.ca \
--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