Patchwork [RFA,3/6] Remove cleanup from print_mention_exception

login
register
mail settings
Submitter Tom Tromey
Date Nov. 30, 2017, 3:01 a.m.
Message ID <20171130030140.14830-4-tom@tromey.com>
Download mbox | patch
Permalink /patch/24617/
State New
Headers show

Comments

Tom Tromey - Nov. 30, 2017, 3:01 a.m.
This removes a cleanup from print_mention_exception by using
string_printf.

ChangeLog
2017-11-29  Tom Tromey  <tom@tromey.com>

	* ada-lang.c (print_mention_exception): Use std::string.
---
 gdb/ChangeLog  | 4 ++++
 gdb/ada-lang.c | 8 +++-----
 2 files changed, 7 insertions(+), 5 deletions(-)

Patch

diff --git a/gdb/ada-lang.c b/gdb/ada-lang.c
index 28df250104..0248663ba8 100644
--- a/gdb/ada-lang.c
+++ b/gdb/ada-lang.c
@@ -12537,11 +12537,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"));