Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
From: Pedro Alves <palves@redhat.com>
To: Tom Tromey <tom@tromey.com>, gdb-patches@sourceware.org
Subject: Re: [RFA 3/8] Use std::string in utils.c
Date: Tue, 03 Oct 2017 10:50:00 -0000	[thread overview]
Message-ID: <9df49461-5dfc-a954-e051-aaf7a3a862f2@redhat.com> (raw)
In-Reply-To: <20171001040643.25162-4-tom@tromey.com>

On 10/01/2017 05:06 AM, Tom Tromey wrote:

>    /* Don't allow infinite error/warning recursion.  */
>    {
> @@ -429,18 +428,17 @@ internal_vproblem (struct internal_problem *problem,
>      char *msg;
>  
>      msg = xstrvprintf (fmt, ap);
> -    reason = xstrprintf ("%s:%d: %s: %s\n"
> -			 "A problem internal to GDB has been detected,\n"
> -			 "further debugging may prove unreliable.",
> -			 file, line, problem->name, msg);
> +    reason = string_printf ("%s:%d: %s: %s\n"
> +			    "A problem internal to GDB has been detected,\n"
> +			    "further debugging may prove unreliable.",
> +			    file, line, problem->name, msg);
>      xfree (msg);
> -    make_cleanup (xfree, reason);

Could you please make msg use string_vprintf too while at it, thus
getting rid of that bare xfree?

(Similarly to the defaulted_query change below, though there we
were using a cleanup.)

Looks good to me with that change.

Thanks,
Pedro Alves

> @@ -978,13 +975,12 @@ defaulted_query (const char *ctlstr, const char defchar, va_list args)
>      }
>  
>    /* Format the question outside of the loop, to avoid reusing args.  */
> -  question = xstrvprintf (ctlstr, args);
> -  old_chain = make_cleanup (xfree, question);
> -  prompt = xstrprintf (_("%s%s(%s or %s) %s"),
> -		      annotation_level > 1 ? "\n\032\032pre-query\n" : "",
> -		      question, y_string, n_string,
> -		      annotation_level > 1 ? "\n\032\032query\n" : "");
> -  make_cleanup (xfree, prompt);
> +  std::string question = string_vprintf (ctlstr, args);
> +  std::string prompt
> +    = string_printf (_("%s%s(%s or %s) %s"),
> +		     annotation_level > 1 ? "\n\032\032pre-query\n" : "",
> +		     question.c_str (), y_string, n_string,
> +		     annotation_level > 1 ? "\n\032\032query\n" : "");
>  


  reply	other threads:[~2017-10-03 10:50 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-10-01  4:06 [RFA 0/8] more cleanup removal Tom Tromey
2017-10-01  4:06 ` [RFA 6/8] Remove make_delete_ui_cleanup Tom Tromey
2017-10-01  4:06 ` [RFA 4/8] Remove unused declarations Tom Tromey
2017-10-01  4:06 ` [RFA 8/8] Use std::string in info_symbol_command Tom Tromey
2017-10-01  4:07 ` [RFA 2/8] Remove set_batch_flag_and_make_cleanup_restore_page_info Tom Tromey
2017-10-01  4:07 ` [RFA 1/8] Change record_full_gdb_operation_disable_set not to return a cleanup Tom Tromey
2017-10-01  4:07 ` [RFA 7/8] Use std::string in gdb_safe_append_history Tom Tromey
2017-10-01  4:07 ` [RFA 3/8] Use std::string in utils.c Tom Tromey
2017-10-03 10:50   ` Pedro Alves [this message]
2017-10-03 11:26     ` Tom Tromey
2017-10-01  4:07 ` [RFA 5/8] Use gdb::byte_vector in load_progress Tom Tromey
2017-10-03 10:55 ` [RFA 0/8] more cleanup removal Pedro Alves

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=9df49461-5dfc-a954-e051-aaf7a3a862f2@redhat.com \
    --to=palves@redhat.com \
    --cc=gdb-patches@sourceware.org \
    --cc=tom@tromey.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