summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPedro Alves <palves@redhat.com>2016-10-17 14:11:27 +0100
committerPedro Alves <palves@redhat.com>2016-10-17 14:39:38 +0100
commit4eb09a503fe5dc5caae8a1e0f8478f356083eaa6 (patch)
treea8242e5134f6575c79d43e3c6b8fc39d1123652c
parentc3553457907ce8fa1225d771b725870c5ed6e53a (diff)
downloadbinutils-gdb-4eb09a503fe5dc5caae8a1e0f8478f356083eaa6.tar.gz
Use ui_file_as_string in gdb/c-exp.y
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.
-rw-r--r--gdb/c-exp.y9
1 files changed, 3 insertions, 6 deletions
diff --git a/gdb/c-exp.y b/gdb/c-exp.y
index 29f672f54c8..f65e3a19e7b 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 ());
}
;