Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
From: Tom Tromey <tom@tromey.com>
To: gdb-patches@sourceware.org
Cc: Tom Tromey <tom@tromey.com>
Subject: [RFA 1/4] Use std::string in ppscm_make_pp_type_error_exception
Date: Sun, 27 May 2018 15:20:00 -0000	[thread overview]
Message-ID: <20180527152009.4228-2-tom@tromey.com> (raw)
In-Reply-To: <20180527152009.4228-1-tom@tromey.com>

This changes ppscm_make_pp_type_error_exception to use std::string,
removing a cleanup.

ChangeLog
2018-05-26  Tom Tromey  <tom@tromey.com>

	* guile/scm-pretty-print.c (ppscm_make_pp_type_error_exception):
	Use string_printf.
---
 gdb/ChangeLog                |  5 +++++
 gdb/guile/scm-pretty-print.c | 14 ++++----------
 2 files changed, 9 insertions(+), 10 deletions(-)

diff --git a/gdb/guile/scm-pretty-print.c b/gdb/guile/scm-pretty-print.c
index da1b7d2be1..5e8a2a998d 100644
--- a/gdb/guile/scm-pretty-print.c
+++ b/gdb/guile/scm-pretty-print.c
@@ -327,16 +327,10 @@ gdbscm_pretty_printer_worker_p (SCM scm)
 static SCM
 ppscm_make_pp_type_error_exception (const char *message, SCM object)
 {
-  char *msg = xstrprintf ("%s: ~S", message);
-  struct cleanup *cleanup = make_cleanup (xfree, msg);
-  SCM exception
-    = gdbscm_make_error (pp_type_error_symbol,
-			 NULL /* func */, msg,
-			 scm_list_1 (object), scm_list_1 (object));
-
-  do_cleanups (cleanup);
-
-  return exception;
+  std::string msg = string_printf ("%s: ~S", message);
+  return gdbscm_make_error (pp_type_error_symbol,
+			    NULL /* func */, msg.c_str (),
+			    scm_list_1 (object), scm_list_1 (object));
 }
 
 /* Print MESSAGE as an exception (meaning it is controlled by
-- 
2.13.6


  parent reply	other threads:[~2018-05-27 15:20 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-05-27 15:20 [RFA 0/4] some simple cleanup removal in guile Tom Tromey
2018-05-27 15:20 ` [RFA 3/4] Return unique_xmalloc_ptr from gdbscm_safe_eval_string Tom Tromey
2018-07-17 13:08   ` Pedro Alves
2018-05-27 15:20 ` Tom Tromey [this message]
2018-07-17 13:08   ` [RFA 1/4] Use std::string in ppscm_make_pp_type_error_exception Pedro Alves
2018-05-27 15:40 ` [RFA 2/4] Change gdbscm_exception_message_to_string to return a unique_xmalloc_ptr Tom Tromey
2018-07-17 13:08   ` Pedro Alves
2018-07-17 19:11     ` Tom Tromey
2018-07-18 13:29       ` [RFC] gdbscm_wrap, eliminate GDBSCM_HANDLE_GDB_EXCEPTION_WITH_CLEANUPS (Re: [RFA 2/4] Change gdbscm_exception_message_to_string to return a unique_xmalloc_ptr) Pedro Alves
2018-07-18 19:34         ` Tom Tromey
2018-07-18 22:31           ` Pedro Alves
2018-05-27 15:54 ` [RFA 4/4] Return unique_xmalloc_ptr from gdbscm_scm_to_string Tom Tromey
2018-07-17 13:09   ` Pedro Alves
2018-06-18 14:37 ` [RFA 0/4] some simple cleanup removal in guile Tom Tromey
2018-07-16 16:35   ` Tom Tromey

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20180527152009.4228-2-tom@tromey.com \
    --to=tom@tromey.com \
    --cc=gdb-patches@sourceware.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox