mirror of
https://github.com/espressif/binutils-gdb.git
synced 2025-10-19 05:42:42 +08:00
Remove cleanups from prompt_for_continue
This removes the cleanups from prompt_for_continue by the use of unique_xmalloc_ptr. gdb/ChangeLog 2018-03-27 Tom Tromey <tom@tromey.com> * utils.c (prompt_for_continue): Use unique_xmalloc_ptr.
This commit is contained in:
@ -1,3 +1,7 @@
|
|||||||
|
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>
|
2018-03-27 Pedro Alves <palves@redhat.com>
|
||||||
Tom Tromey <tom@tromey.com>
|
Tom Tromey <tom@tromey.com>
|
||||||
|
|
||||||
|
@ -1479,9 +1479,7 @@ set_screen_width_and_height (int width, int height)
|
|||||||
static void
|
static void
|
||||||
prompt_for_continue (void)
|
prompt_for_continue (void)
|
||||||
{
|
{
|
||||||
char *ignore;
|
|
||||||
char cont_prompt[120];
|
char cont_prompt[120];
|
||||||
struct cleanup *old_chain = make_cleanup (null_cleanup, NULL);
|
|
||||||
/* Used to add duration we waited for user to respond to
|
/* Used to add duration we waited for user to respond to
|
||||||
prompt_for_continue_wait_time. */
|
prompt_for_continue_wait_time. */
|
||||||
using namespace std::chrono;
|
using namespace std::chrono;
|
||||||
@ -1504,8 +1502,7 @@ prompt_for_continue (void)
|
|||||||
|
|
||||||
/* Call gdb_readline_wrapper, not readline, in order to keep an
|
/* Call gdb_readline_wrapper, not readline, in order to keep an
|
||||||
event loop running. */
|
event loop running. */
|
||||||
ignore = gdb_readline_wrapper (cont_prompt);
|
gdb::unique_xmalloc_ptr<char> ignore (gdb_readline_wrapper (cont_prompt));
|
||||||
make_cleanup (xfree, ignore);
|
|
||||||
|
|
||||||
/* Add time spend in this routine to prompt_for_continue_wait_time. */
|
/* Add time spend in this routine to prompt_for_continue_wait_time. */
|
||||||
prompt_for_continue_wait_time += steady_clock::now () - prompt_started;
|
prompt_for_continue_wait_time += steady_clock::now () - prompt_started;
|
||||||
@ -1515,7 +1512,7 @@ prompt_for_continue (void)
|
|||||||
|
|
||||||
if (ignore != NULL)
|
if (ignore != NULL)
|
||||||
{
|
{
|
||||||
char *p = ignore;
|
char *p = ignore.get ();
|
||||||
|
|
||||||
while (*p == ' ' || *p == '\t')
|
while (*p == ' ' || *p == '\t')
|
||||||
++p;
|
++p;
|
||||||
@ -1529,8 +1526,6 @@ prompt_for_continue (void)
|
|||||||
reinitialize_more_filter ();
|
reinitialize_more_filter ();
|
||||||
|
|
||||||
dont_repeat (); /* Forget prev cmd -- CR won't repeat it. */
|
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. */
|
/* Initialize timer to keep track of how long we waited for the user. */
|
||||||
|
Reference in New Issue
Block a user