[PATCH] Use std::string for 'psargs'.
John Baldwin
jhb@FreeBSD.org
Thu Mar 5 23:58:00 GMT 2020
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
More information about the Gdb-patches
mailing list