From: Tom Tromey <tromey@redhat.com>
To: Pedro Alves <palves@redhat.com>
Cc: gdb-patches@sourceware.org
Subject: Re: [RFC/RFA PATCH] Constify strings in tracepoint.c, lookup_cmd and the completers.
Date: Wed, 13 Mar 2013 17:29:00 -0000 [thread overview]
Message-ID: <87vc8vb44s.fsf@fleche.redhat.com> (raw)
In-Reply-To: <20130313123205.31184.43525.stgit@brno.lan> (Pedro Alves's message of "Wed, 13 Mar 2013 12:32:05 +0000")
>>>>> "Pedro" == Pedro Alves <palves@redhat.com> writes:
Pedro> That ended up constifying lookup_cmd/add_cmd and (lots of) friends,
Pedro> and the completers.
Very nice. I'd like to see it go in.
A few trivial nits below.
Pedro> I didn't try to constify the command hooks themselves, because I know
Pedro> upfront there are commands that write to the command string argument,
Pedro> and I think I managed to stop at a nice non-hacky split point already.
Yeah, I think changing the commands difficult to do incrementally.
I have a trick I'm playing with to let it work file-by-file; but really
this just shows that a lot of plumbing has to be constified first...
Pedro> I think the only non-really-super-obvious changes are
Pedro> tracepoint.c:validate_actionline, and tracepoint.c:trace_dump_actions.
In trace_dump_actions, I think that the "line" local variable is now
dead, and the code would be clearer if you just removed it.
Pedro> +static struct expression *
Pedro> +parse_exp_in_context (const char **stringptr, CORE_ADDR pc, const struct block *block,
Over-long line.
Pedro> +parse_exp_in_context_1 (char **stringptr, CORE_ADDR pc, const struct block *block,
Here too.
Pedro> @@ -1402,8 +1408,10 @@ x_command (char *exp, int from_tty)
Pedro> if (exp && *exp == '/')
Pedro> {
Pedro> - exp++;
Pedro> - fmt = decode_format (&exp, last_format, last_size);
Pedro> + const char *tmp = exp + 1;
Pedro> +
Pedro> + fmt = decode_format (&tmp, last_format, last_size);
Pedro> + exp = (char *) tmp;
I see x_command can't have the same "char *arg" treatment as
display_command:
/* Cause expression not to be there any more if this command is
repeated with Newline. But don't clobber a user-defined
command's definition. */
if (from_tty)
*exp = 0;
Gross!
Tom
next prev parent reply other threads:[~2013-03-13 17:29 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-03-13 12:32 Pedro Alves
2013-03-13 17:22 ` Keith Seitz
2013-03-13 17:29 ` Tom Tromey [this message]
2013-03-13 18:31 ` 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=87vc8vb44s.fsf@fleche.redhat.com \
--to=tromey@redhat.com \
--cc=gdb-patches@sourceware.org \
--cc=palves@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