Use ui_file_as_string in gdb/c-exp.y
authorPedro Alves <palves@redhat.com>
Tue, 8 Nov 2016 15:26:46 +0000 (15:26 +0000)
committerPedro Alves <palves@redhat.com>
Tue, 8 Nov 2016 15:26:46 +0000 (15:26 +0000)
gdb/ChangeLog:
2016-11-08  Pedro Alves  <palves@redhat.com>

* c-exp.y (OPERATOR NEW): Adjust to use ui_file_as_string and
std::string.

gdb/ChangeLog
gdb/c-exp.y

index b07e744b0b76cc3f91070f28647bbb7817dc1676..5e83034746175c64cad40f3a4e269f86ff07b365 100644 (file)
@@ -1,3 +1,8 @@
+2016-11-08  Pedro Alves  <palves@redhat.com>
+
+       * c-exp.y (OPERATOR NEW): Adjust to use ui_file_as_string and
+       std::string.
+
 2016-11-08  Pedro Alves  <palves@redhat.com>
 
        * c-lang.h (c_compute_program): Now returns std::string.
index 29f672f54c8a6027e60f9dff6e597c20c8b36a56..f65e3a19e7b4b17bbe0984ca087c1a815cc7af44 100644 (file)
@@ -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 ());
                        }
        ;