[PATCH] Use std::string for 'psargs'.

Simon Marchi simark@simark.ca
Thu Mar 5 23:15:00 GMT 2020


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.

LGTM in any case, thanks!

Simon



More information about the Gdb-patches mailing list