diff options
author | Pedro Alves <palves@redhat.com> | 2016-11-08 15:26:45 +0000 |
---|---|---|
committer | Pedro Alves <palves@redhat.com> | 2016-11-08 15:26:45 +0000 |
commit | 02030646c2a799614d31e52008403d8be067ac5d (patch) | |
tree | 80644209a1668d0808bc64335b19c91d93907990 /gdb | |
parent | 7b01d34b2a62fb8cda96fe40c755f99e63b8ba4f (diff) | |
download | gdb-02030646c2a799614d31e52008403d8be067ac5d.zip gdb-02030646c2a799614d31e52008403d8be067ac5d.tar.gz gdb-02030646c2a799614d31e52008403d8be067ac5d.tar.bz2 |
Use ui_file_as_string in gdb/printcmd.c
Yet another cleanup eliminated.
gdb/ChangeLog:
2016-11-08 Pedro Alves <palves@redhat.com>
* printcmd.c (eval_command): Use ui_file_as_string and
std::string.
Diffstat (limited to 'gdb')
-rw-r--r-- | gdb/ChangeLog | 5 | ||||
-rw-r--r-- | gdb/printcmd.c | 6 |
2 files changed, 7 insertions, 4 deletions
diff --git a/gdb/ChangeLog b/gdb/ChangeLog index 08699ed..254893f 100644 --- a/gdb/ChangeLog +++ b/gdb/ChangeLog @@ -1,5 +1,10 @@ 2016-11-08 Pedro Alves <palves@redhat.com> + * printcmd.c (eval_command): Use ui_file_as_string and + std::string. + +2016-11-08 Pedro Alves <palves@redhat.com> + * top.c (quit_confirm): Use ui_file_as_string and std::string. 2016-11-08 Pedro Alves <palves@redhat.com> diff --git a/gdb/printcmd.c b/gdb/printcmd.c index b70ed19..23de57c 100644 --- a/gdb/printcmd.c +++ b/gdb/printcmd.c @@ -2719,14 +2719,12 @@ eval_command (char *arg, int from_tty) { struct ui_file *ui_out = mem_fileopen (); struct cleanup *cleanups = make_cleanup_ui_file_delete (ui_out); - char *expanded; ui_printf (arg, ui_out); - expanded = ui_file_xstrdup (ui_out, NULL); - make_cleanup (xfree, expanded); + std::string expanded = ui_file_as_string (ui_out); - execute_command (expanded, from_tty); + execute_command (&expanded[0], from_tty); do_cleanups (cleanups); } |