+2018-03-27 Tom Tromey <tom@tromey.com>
+
+ * utils.c (prompt_for_continue): Use unique_xmalloc_ptr.
+
2018-03-27 Pedro Alves <palves@redhat.com>
Tom Tromey <tom@tromey.com>
static void
prompt_for_continue (void)
{
- char *ignore;
char cont_prompt[120];
- struct cleanup *old_chain = make_cleanup (null_cleanup, NULL);
/* Used to add duration we waited for user to respond to
prompt_for_continue_wait_time. */
using namespace std::chrono;
/* Call gdb_readline_wrapper, not readline, in order to keep an
event loop running. */
- ignore = gdb_readline_wrapper (cont_prompt);
- make_cleanup (xfree, ignore);
+ gdb::unique_xmalloc_ptr<char> ignore (gdb_readline_wrapper (cont_prompt));
/* Add time spend in this routine to prompt_for_continue_wait_time. */
prompt_for_continue_wait_time += steady_clock::now () - prompt_started;
if (ignore != NULL)
{
- char *p = ignore;
+ char *p = ignore.get ();
while (*p == ' ' || *p == '\t')
++p;
reinitialize_more_filter ();
dont_repeat (); /* Forget prev cmd -- CR won't repeat it. */
-
- do_cleanups (old_chain);
}
/* Initialize timer to keep track of how long we waited for the user. */