From 95bc9f0bf06637cf9c1147008ac32d6b00c42707 Mon Sep 17 00:00:00 2001 From: Tom Tromey Date: Sat, 29 Dec 2018 12:42:18 -0700 Subject: 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 * event-top.h (command_line_handler): Update. * top.c (class gdb_readline_wrapper_cleanup) : Update. (gdb_readline_wrapper_line): Update. * top.h (struct ui) : 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 *. --- gdb/mi/mi-interp.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) (limited to 'gdb/mi') diff --git a/gdb/mi/mi-interp.c b/gdb/mi/mi-interp.c index 9a317bc0ecd..fd446c20e69 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 &&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 &&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 -- cgit v1.2.3-65-gdbad