+2021-05-06 Simon Marchi <simon.marchi@polymtl.ca>
+
+ * inferior.h (class inferior) <args>: Change type to
+ unique_xmalloc_ptr.
+ * inferior.c (inferior::~inferior): Don't free args.
+ * infcmd.c (get_inferior_args): Adjust.
+ (set_inferior_args): Adjust.
+
2021-05-06 Andrew Burgess <andrew.burgess@embecosm.com>
* guile/scm-breakpoint.c (bpscm_print_breakpoint_smob): Only print
}
if (current_inferior ()->args == NULL)
- current_inferior ()->args = xstrdup ("");
+ current_inferior ()->args = make_unique_xstrdup ("");
- return current_inferior ()->args;
+ return current_inferior ()->args.get ();
}
/* Set the arguments for the current inferior. Ownership of
void
set_inferior_args (const char *newargs)
{
- xfree (current_inferior ()->args);
- current_inferior ()->args = newargs ? xstrdup (newargs) : NULL;
+ if (newargs != nullptr)
+ current_inferior ()->args = make_unique_xstrdup (newargs);
+ else
+ current_inferior ()->args.reset ();
+
current_inferior ()->argc = 0;
current_inferior ()->argv = 0;
}
struct program_space *pspace = NULL;
/* The arguments string to use when running. */
- char *args = NULL;
+ gdb::unique_xmalloc_ptr<char> args;
/* The size of elements in argv. */
int argc = 0;