Remove cleanup from print_mention_exception
authorTom Tromey <tom@tromey.com>
Fri, 10 Nov 2017 21:42:35 +0000 (14:42 -0700)
committerTom Tromey <tom@tromey.com>
Fri, 4 May 2018 18:12:16 +0000 (12:12 -0600)
This removes a cleanup from print_mention_exception by using
string_printf.

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

* ada-lang.c (print_mention_exception): Use std::string.

gdb/ChangeLog
gdb/ada-lang.c

index 1a86a21071650d4882eda386ed2415a928d71c8a..730a357216dc893080f72ea2b0f3dd0b00835bbf 100644 (file)
@@ -1,3 +1,7 @@
+2018-05-04  Tom Tromey  <tom@tromey.com>
+
+       * ada-lang.c (print_mention_exception): Use std::string.
+
 2018-05-04  Tom Tromey  <tom@tromey.com>
 
        * ada-lang.c (create_excep_cond_exprs): Update.
index 1af09bc00ecc42f9c103b5fd6f3b34d22b6b3c0c..7cbf1ec08de57ab61510b1152e1dedb582f41cf8 100644 (file)
@@ -12805,11 +12805,9 @@ print_mention_exception (enum ada_exception_catchpoint_kind ex,
       case ada_catch_exception:
         if (c->excep_string != NULL)
          {
-           char *info = xstrprintf (_("`%s' Ada exception"), c->excep_string);
-           struct cleanup *old_chain = make_cleanup (xfree, info);
-
-           uiout->text (info);
-           do_cleanups (old_chain);
+           std::string info = string_printf (_("`%s' Ada exception"),
+                                             c->excep_string);
+           uiout->text (info.c_str ());
          }
         else
           uiout->text (_("all Ada exceptions"));