From: Pedro Alves Date: Tue, 8 Nov 2016 15:26:46 +0000 (+0000) Subject: Use ui_file_as_string in gdb/c-exp.y X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=66bbce5bda870c49a68f2b77a29fb96eca72632f;p=binutils-gdb.git Use ui_file_as_string in gdb/c-exp.y gdb/ChangeLog: 2016-11-08 Pedro Alves * c-exp.y (OPERATOR NEW): Adjust to use ui_file_as_string and std::string. --- diff --git a/gdb/ChangeLog b/gdb/ChangeLog index b07e744b0b7..5e830347461 100644 --- a/gdb/ChangeLog +++ b/gdb/ChangeLog @@ -1,3 +1,8 @@ +2016-11-08 Pedro Alves + + * c-exp.y (OPERATOR NEW): Adjust to use ui_file_as_string and + std::string. + 2016-11-08 Pedro Alves * c-lang.h (c_compute_program): Now returns std::string. 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 ()); } ;