Use std::string in ppscm_make_pp_type_error_exception
authorTom Tromey <tom@tromey.com>
Sun, 27 May 2018 05:16:13 +0000 (23:16 -0600)
committerTom Tromey <tom@tromey.com>
Tue, 17 Jul 2018 19:21:46 +0000 (13:21 -0600)
This changes ppscm_make_pp_type_error_exception to use std::string,
removing a cleanup.

gdb/ChangeLog
2018-07-17  Tom Tromey  <tom@tromey.com>

* guile/scm-pretty-print.c (ppscm_make_pp_type_error_exception):
Use string_printf.

gdb/ChangeLog
gdb/guile/scm-pretty-print.c

index f4a3f75ce8f6806957ede2d25d3be0436c46ded6..584ea6f0b719888d2959ca1708d4857d888542c2 100644 (file)
@@ -1,3 +1,8 @@
+2018-07-17  Tom Tromey  <tom@tromey.com>
+
+       * guile/scm-pretty-print.c (ppscm_make_pp_type_error_exception):
+       Use string_printf.
+
 2018-07-17  Jim Wilson  <jimw@sifive.com>
 
        * riscv-tdep.c (riscv_has_feature): Delete comment that refers to
index da1b7d2be15284ba5e8031d9ea2a41feaee05c34..5e8a2a998d21e20d20ceb59eb56e8706f2c678e9 100644 (file)
@@ -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
This page took 0.059609 seconds and 4 git commands to generate.