From: Pedro Alves <palves@redhat.com>
To: Eli Zaretskii <eliz@gnu.org>
Cc: Keith Seitz <keiths@redhat.com>, gdb-patches@sourceware.org
Subject: Re: [RFA] Constify find_condition_and_thread
Date: Fri, 01 Mar 2013 18:56:00 -0000 [thread overview]
Message-ID: <5130F9BB.6020002@redhat.com> (raw)
In-Reply-To: <83ppzjufp5.fsf@gnu.org>
On 03/01/2013 06:40 PM, Eli Zaretskii wrote:
>> Date: Fri, 01 Mar 2013 10:18:37 -0800
>> From: Keith Seitz <keiths@redhat.com>
>>
>> - expr = parse_exp_1 (&tok, pc, block_for_pc (pc), 0);
>> + orig = copy = xstrdup (tok);
>> + cleanup = make_cleanup (xfree, orig);
>> + expr = parse_exp_1 (©, pc, block_for_pc (pc), 0);
>> xfree (expr);
>> + tok += copy - orig;
>> + do_cleanups (cleanup);
>
> If we really need this kind of dance, just to avoid explicit casts to
> 'char *', there should be a comment explaining why we do this.
Yeah. I think casting the const out would be okay, and
better than forcing a xstrdup. (run time cost, and extra
complication for not that much gain over cast).
An alternative would be to perhaps make the interface of
parse_exp_1 similar to strtol -- split input and output
pointers, with the explicit guarantee that the output pointer
points somewhere within the input string. Is it really that
messy? There doesn't seem to be many parse_exp_1 callers.
--
Pedro Alves
next prev parent reply other threads:[~2013-03-01 18:56 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-03-01 18:18 Keith Seitz
2013-03-01 18:40 ` Eli Zaretskii
2013-03-01 18:56 ` Pedro Alves [this message]
2013-03-01 19:33 ` Tom Tromey
2013-03-02 7:30 ` Eli Zaretskii
2013-03-01 18:56 ` 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=5130F9BB.6020002@redhat.com \
--to=palves@redhat.com \
--cc=eliz@gnu.org \
--cc=gdb-patches@sourceware.org \
--cc=keiths@redhat.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