Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
From: John Baldwin <jhb@FreeBSD.org>
To: Simon Marchi <simark@simark.ca>, gdb-patches@sourceware.org
Subject: Re: [PATCH] Use std::string for 'psargs'.
Date: Thu, 05 Mar 2020 23:58:00 -0000	[thread overview]
Message-ID: <32c487ea-717e-8b34-d198-3d8c6c4ec604@FreeBSD.org> (raw)
In-Reply-To: <7d74b9b3-6a10-f32c-9bfc-8ed89aa32629@simark.ca>

On 3/5/20 3:15 PM, Simon Marchi wrote:
> On 2020-03-05 6:06 p.m., John Baldwin wrote:
>> diff --git a/gdb/fbsd-tdep.c b/gdb/fbsd-tdep.c
>> index bc1b5afd02..ffffb18700 100644
>> --- a/gdb/fbsd-tdep.c
>> +++ b/gdb/fbsd-tdep.c
>> @@ -725,14 +725,14 @@ fbsd_make_corefile_notes (struct gdbarch *gdbarch, bfd *obfd, int *note_size)
>>    if (get_exec_file (0))
>>      {
>>        const char *fname = lbasename (get_exec_file (0));
>> -      char *psargs = xstrdup (fname);
>> +      std::string psargs = fname;
>>  
>> -      if (get_inferior_args ())
>> -	psargs = reconcat (psargs, psargs, " ", get_inferior_args (),
>> -			   (char *) NULL);
>> +      const char *infargs = get_inferior_args ();
>> +      if (infargs != NULL)
>> +	psargs = psargs + " " + infargs;
> 
> Doesn't really matter, but you could use += here.

I almost did, but based this on the similar code in linux-tdep.c and went
with consistency.

-- 
John Baldwin


      reply	other threads:[~2020-03-05 23:58 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-03-05 23:07 John Baldwin
2020-03-05 23:15 ` Simon Marchi
2020-03-05 23:58   ` John Baldwin [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=32c487ea-717e-8b34-d198-3d8c6c4ec604@FreeBSD.org \
    --to=jhb@freebsd.org \
    --cc=gdb-patches@sourceware.org \
    --cc=simark@simark.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