From db1ec11fff1a46f7046bcbd971a42632d2ea795c Mon Sep 17 00:00:00 2001 From: Pedro Alves Date: Tue, 8 Nov 2016 15:26:45 +0000 Subject: Use ui_file_as_string in execute_command_to_string ... and then return std::string and adjust all callers. gdb/ChangeLog: 2016-11-08 Pedro Alves * gdbcmd.h (execute_command_to_string): Now returns std::string. (lookup_struct_elt_type): Adjust to use std::string. * top.c (execute_command_to_string): Use ui_file_as_string and return std::string. * guile/guile.c (gdbscm_execute_gdb_command): Adjust to use std::string. * python/python.c (execute_gdb_command): Adjust to use std::string. --- gdb/top.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) (limited to 'gdb/top.c') diff --git a/gdb/top.c b/gdb/top.c index c7a9c21..504a4de 100644 --- a/gdb/top.c +++ b/gdb/top.c @@ -690,12 +690,11 @@ execute_command (char *p, int from_tty) returned string, do not display it to the screen. BATCH_FLAG will be temporarily set to true. */ -char * +std::string execute_command_to_string (char *p, int from_tty) { struct ui_file *str_file; struct cleanup *cleanup; - char *retval; /* GDB_STDOUT should be better already restored during these restoration callbacks. */ @@ -725,7 +724,7 @@ execute_command_to_string (char *p, int from_tty) execute_command (p, from_tty); - retval = ui_file_xstrdup (str_file, NULL); + std::string retval = ui_file_as_string (str_file); do_cleanups (cleanup); -- cgit v1.1