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] Remove cleanup from complaints.c


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

commit 55b064321eed6cccf511fd698c732890e3ba4c6b
Author: Tom Tromey <tom@tromey.com>
Date:   Wed Sep 27 20:54:17 2017 -0600

    Remove cleanup from complaints.c
    
    This removes a cleanup from complaints.c by using std::string.
    
    gdb/ChangeLog
    2017-09-29  Tom Tromey  <tom@tromey.com>
    
    	* complaints.c (vcomplaint): Use std::string.

Diff:
---
 gdb/ChangeLog    | 4 ++++
 gdb/complaints.c | 9 +++------
 2 files changed, 7 insertions(+), 6 deletions(-)

diff --git a/gdb/ChangeLog b/gdb/ChangeLog
index fda1592..d2678d4 100644
--- a/gdb/ChangeLog
+++ b/gdb/ChangeLog
@@ -1,5 +1,9 @@
 2017-09-29  Tom Tromey  <tom@tromey.com>
 
+	* complaints.c (vcomplaint): Use std::string.
+
+2017-09-29  Tom Tromey  <tom@tromey.com>
+
 	* tracepoint.c (trace_variable_command): Use std::string.
 	(encode_actions_1): Remove unused declarations.
 	(create_tsv_from_upload): Use std::string.
diff --git a/gdb/complaints.c b/gdb/complaints.c
index aba305c..58b6b7b 100644
--- a/gdb/complaints.c
+++ b/gdb/complaints.c
@@ -192,16 +192,14 @@ vcomplaint (struct complaints **c, const char *file,
 	vwarning (fmt, args);
       else
 	{
-	  char *msg;
-	  struct cleanup *cleanups;
-	  msg = xstrvprintf (fmt, args);
-	  cleanups = make_cleanup (xfree, msg);
+	  std::string msg = string_vprintf (fmt, args);
 	  wrap_here ("");
 	  if (series != SUBSEQUENT_MESSAGE)
 	    begin_line ();
 	  /* XXX: i18n */
 	  fprintf_filtered (gdb_stderr, "%s%s%s",
-			    complaints->explanation[series].prefix, msg,
+			    complaints->explanation[series].prefix,
+			    msg.c_str (),
 			    complaints->explanation[series].postfix);
 	  /* Force a line-break after any isolated message.  For the
              other cases, clear_complaints() takes care of any missing
@@ -214,7 +212,6 @@ vcomplaint (struct complaints **c, const char *file,
 	    fputs_filtered ("\n", gdb_stderr);
 	  else
 	    wrap_here ("");
-	  do_cleanups (cleanups);
 	}
     }


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