From: Andrew Burgess <andrew.burgess@embecosm.com>
To: Simon Marchi <simon.marchi@polymtl.ca>
Cc: gdb-patches@sourceware.org
Subject: Re: [PATCHv2 2/2] gdb/guile: Have gdbscm_safe_source_script return a unique_ptr
Date: Fri, 7 May 2021 09:55:28 +0100 [thread overview]
Message-ID: <20210507085528.GG6612@embecosm.com> (raw)
In-Reply-To: <4d2ff439-afdf-08d1-2ec2-a07d07a0739c@polymtl.ca>
* Simon Marchi <simon.marchi@polymtl.ca> [2021-05-05 22:32:40 -0400]:
> On 2021-05-05 10:28 p.m., Simon Marchi via Gdb-patches wrote:
> > On 2021-05-05 5:01 p.m., Andrew Burgess wrote:
> >> diff --git a/gdb/guile/scm-safe-call.c b/gdb/guile/scm-safe-call.c
> >> index 5bea970239b..a475774f921 100644
> >> --- a/gdb/guile/scm-safe-call.c
> >> +++ b/gdb/guile/scm-safe-call.c
> >> @@ -432,7 +432,7 @@ scscm_source_scheme_script (void *data)
> >> printed according to "set guile print-stack" and the result is an error
> >> message allocated with malloc, caller must free. */
> >>
> >> -char *
> >> +gdb::unique_xmalloc_ptr<char>
> >> gdbscm_safe_source_script (const char *filename)
> >> {
> >> /* scm_c_primitive_load_path only looks in %load-path for files with
> >> @@ -454,7 +454,7 @@ gdbscm_safe_source_script (const char *filename)
> >> (void *) filename);
> >>
> >> if (result != NULL)
> >> - return xstrdup (result);
> >> + return make_unique_xstrdup (result);
> >> return NULL;
> >
> > Hmm, result comes from gdbscm_with_guile, which states:
> >
> > The result if NULL if no exception occurred, otherwise it is a statically
> > allocated error message (caller must *not* free). */
>
> Ahh, nevermind. I noticed now that it's "make_unique_xstrdup". I first
> read it as just creating a unique pointer to wrap result.
>
> LGTM then!
Thanks. I pushed this patch independently of patch #1.
Andrew
prev parent reply other threads:[~2021-05-07 8:55 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-05-05 17:40 [PATCH] gdb/guile: perform tilde expansion when sourcing guile scripts Andrew Burgess
2021-05-05 19:11 ` Tom Tromey
2021-05-05 21:01 ` [PATCHv2 0/2] " Andrew Burgess
2021-05-05 21:01 ` [PATCHv2 1/2] " Andrew Burgess
2021-05-06 2:23 ` Simon Marchi via Gdb-patches
2021-05-07 10:29 ` Andrew Burgess
2021-05-07 14:55 ` Simon Marchi via Gdb-patches
2021-05-07 21:23 ` Andrew Burgess
2021-05-05 21:01 ` [PATCHv2 2/2] gdb/guile: Have gdbscm_safe_source_script return a unique_ptr Andrew Burgess
2021-05-06 2:28 ` Simon Marchi via Gdb-patches
2021-05-06 2:32 ` Simon Marchi via Gdb-patches
2021-05-07 8:55 ` Andrew Burgess [this message]
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=20210507085528.GG6612@embecosm.com \
--to=andrew.burgess@embecosm.com \
--cc=gdb-patches@sourceware.org \
--cc=simon.marchi@polymtl.ca \
/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