This is the mail archive of the
gdb-patches@sourceware.org
mailing list for the GDB project.
[RFA] Removes xfree/cleanup and C++fy in two exception functions.
- From: Xavier Roirand <roirand at adacore dot com>
- To: gdb-patches at sourceware dot org
- Cc: Xavier Roirand <roirand at adacore dot com>, brobecker at adacore dot com
- Date: Fri, 22 Dec 2017 12:09:41 +0100
- Subject: [RFA] Removes xfree/cleanup and C++fy in two exception functions.
- Authentication-results: sourceware.org; auth=none
This remove xstrprintf/xfree use and C++fy in two exception functions.
gdb/ChangeLog:
* ada-lang.c (print_one_exception): Remove xstrprintf/xfree use.
(print_mention_exception): C++fy.
Tested on x86_64-linux.
---
gdb/ada-lang.c | 15 ++++++---------
1 file changed, 6 insertions(+), 9 deletions(-)
diff --git a/gdb/ada-lang.c b/gdb/ada-lang.c
index dad2b17..03f3e56 100644
--- a/gdb/ada-lang.c
+++ b/gdb/ada-lang.c
@@ -12745,10 +12745,9 @@ print_one_exception (enum ada_exception_catchpoint_kind ex,
case ada_catch_exception:
if (c->excep_string != NULL)
{
- char *msg = xstrprintf (_("`%s' Ada exception"), c->excep_string);
-
- uiout->field_string ("what", msg);
- xfree (msg);
+ uiout->field_fmt ("what",
+ _("`%s' Ada exception"),
+ c->excep_string);
}
else
uiout->field_string ("what", "all Ada exceptions");
@@ -12789,11 +12788,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"));
--
2.7.4