Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
From: Joel Brobecker <brobecker@adacore.com>
To: Xavier Roirand <roirand@adacore.com>
Cc: gdb-patches@sourceware.org
Subject: Re: [RFA] Removes xfree/cleanup and C++fy in two exception functions.
Date: Fri, 22 Dec 2017 11:32:00 -0000	[thread overview]
Message-ID: <20171222113238.iljgn5sgvs3bfymc@adacore.com> (raw)
In-Reply-To: <1513940981-32741-1-git-send-email-roirand@adacore.com>

Thanks Xavier.

> This remove xstrprintf/xfree use and C++fy in two exception functions.

remove -> removes.
C++fy -> C++ify or C++-ify.

But, rather than saying "C++ify", let's be more specific and just say
that we use C++ to remote a cleanup (that's the objective, right?).

> gdb/ChangeLog:
> 
>     * ada-lang.c (print_one_exception): Remove xstrprintf/xfree use.
>     (print_mention_exception): C++fy.

Same here: Let's be a bit more specific that just a mysterious C++ify.

Pre-approved with those changes above.

> 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

-- 
Joel


      reply	other threads:[~2017-12-22 11:32 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-12-22 11:09 Xavier Roirand
2017-12-22 11:32 ` Joel Brobecker [this message]

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=20171222113238.iljgn5sgvs3bfymc@adacore.com \
    --to=brobecker@adacore.com \
    --cc=gdb-patches@sourceware.org \
    --cc=roirand@adacore.com \
    /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