aboutsummaryrefslogtreecommitdiff
path: root/gdb/mi/mi-interp.c
diff options
context:
space:
mode:
authorTom Tromey <tom@tromey.com>2018-12-29 12:42:18 -0700
committerTom Tromey <tom@tromey.com>2018-12-30 08:54:13 -0700
commit95bc9f0bf06637cf9c1147008ac32d6b00c42707 (patch)
tree8af056bf84c73a05ff6c6c85068c90a5bf5f2e66 /gdb/mi/mi-interp.c
parentecad3b215d34263968bb7c74701e3ca9483ac710 (diff)
downloadbinutils-95bc9f0bf06637cf9c1147008ac32d6b00c42707.zip
binutils-95bc9f0bf06637cf9c1147008ac32d6b00c42707.tar.gz
binutils-95bc9f0bf06637cf9c1147008ac32d6b00c42707.tar.bz2
Change input_handler to take a unique_xmalloc_ptr
This changes ui::input_handler to take a unique_xmalloc_ptr. This clarifies the ownership transfer of input_handler's argument. gdb/ChangeLog 2018-12-30 Tom Tromey <tom@tromey.com> * event-top.h (command_line_handler): Update. * top.c (class gdb_readline_wrapper_cleanup) <m_handler_orig>: Update. (gdb_readline_wrapper_line): Update. * top.h (struct ui) <input_handler>: Take a unique_xmalloc_ptr. (handle_line_of_input): Update. * event-top.c: Update. (gdb_readline_no_editing_callback): Update. (command_line_handler): Take a unique_xmalloc_ptr. (handle_line_of_input): Take a const char *. (command_line_append_input_line): Take a const char *.
Diffstat (limited to 'gdb/mi/mi-interp.c')
-rw-r--r--gdb/mi/mi-interp.c7
1 files changed, 4 insertions, 3 deletions
diff --git a/gdb/mi/mi-interp.c b/gdb/mi/mi-interp.c
index 9a317bc..fd446c2 100644
--- a/gdb/mi/mi-interp.c
+++ b/gdb/mi/mi-interp.c
@@ -43,7 +43,8 @@
interpreter. */
static void mi_execute_command_wrapper (const char *cmd);
-static void mi_execute_command_input_handler (char *cmd);
+static void mi_execute_command_input_handler
+ (gdb::unique_xmalloc_ptr<char> &&cmd);
/* These are hooks that we put in place while doing interpreter_exec
so we can report interesting things that happened "behind the MI's
@@ -294,14 +295,14 @@ mi_on_sync_execution_done (void)
/* mi_execute_command_wrapper wrapper suitable for INPUT_HANDLER. */
static void
-mi_execute_command_input_handler (char *cmd)
+mi_execute_command_input_handler (gdb::unique_xmalloc_ptr<char> &&cmd)
{
struct mi_interp *mi = as_mi_interp (top_level_interpreter ());
struct ui *ui = current_ui;
ui->prompt_state = PROMPT_NEEDED;
- mi_execute_command_wrapper (cmd);
+ mi_execute_command_wrapper (cmd.get ());
/* Print a prompt, indicating we're ready for further input, unless
we just started a synchronous command. In that case, we're about