This is the mail archive of the gdb-cvs@sourceware.org mailing list for the GDB project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[binutils-gdb] Use ui_file_as_string in gdb/c-exp.y


https://sourceware.org/git/gitweb.cgi?p=binutils-gdb.git;h=66bbce5bda870c49a68f2b77a29fb96eca72632f

commit 66bbce5bda870c49a68f2b77a29fb96eca72632f
Author: Pedro Alves <palves@redhat.com>
Date:   Tue Nov 8 15:26:46 2016 +0000

    Use ui_file_as_string in gdb/c-exp.y
    
    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.

Diff:
---
 gdb/ChangeLog | 5 +++++
 gdb/c-exp.y   | 9 +++------
 2 files changed, 8 insertions(+), 6 deletions(-)

diff --git a/gdb/ChangeLog b/gdb/ChangeLog
index b07e744..5e83034 100644
--- a/gdb/ChangeLog
+++ b/gdb/ChangeLog
@@ -1,5 +1,10 @@
 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.
 	* compile/compile-internal.h (class compile_file_names): New
 	class.
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 ());
 			}
 	;


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]