This is the mail archive of the
gdb-patches@sourceware.org
mailing list for the GDB project.
[PATCH v2 22/31] Use ui_file_as_string in gdb/c-exp.y
- From: Pedro Alves <palves at redhat dot com>
- To: gdb-patches at sourceware dot org
- Date: Wed, 19 Oct 2016 02:12:10 +0100
- Subject: [PATCH v2 22/31] Use ui_file_as_string in gdb/c-exp.y
- Authentication-results: sourceware.org; auth=none
- References: <1476839539-8374-1-git-send-email-palves@redhat.com>
gdb/ChangeLog:
yyyy-mm-yy Pedro Alves <palves@redhat.com>
* c-exp.y (OPERATOR NEW): Adjust to use ui_file_as_string and
std::string.
---
gdb/c-exp.y | 9 +++------
1 file changed, 3 insertions(+), 6 deletions(-)
diff --git a/gdb/c-exp.y b/gdb/c-exp.y
index 29f672f..f65e3a1 100644
--- a/gdb/c-exp.y
+++ b/gdb/c-exp.y
@@ -1555,16 +1555,13 @@ oper: OPERATOR NEW
| OPERATOR OBJC_LBRAC ']'
{ $$ = operator_stoken ("[]"); }
| OPERATOR conversion_type_id
- { char *name;
- long length;
- struct ui_file *buf = mem_fileopen ();
+ { struct ui_file *buf = mem_fileopen ();
c_print_type ($2, NULL, buf, -1, 0,
&type_print_raw_options);
- name = ui_file_xstrdup (buf, &length);
+ std::string name = ui_file_as_string (buf);
ui_file_delete (buf);
- $$ = operator_stoken (name);
- free (name);
+ $$ = operator_stoken (name.c_str ());
}
;
--
2.5.5