From: Michael Snyder <msnyder@specifix.com>
To: Yakov Lerner <iler.ml@gmail.com>
Cc: gdb-patches@sourceware.org
Subject: Re: simlpe patch implements eval command (with printf-like format and args)
Date: Thu, 21 Feb 2008 22:37:00 -0000 [thread overview]
Message-ID: <1203631895.19253.213.camel@localhost.localdomain> (raw)
In-Reply-To: <f36b08ee0802210120t9646eewf1ae66469883e6f0@mail.gmail.com>
On Thu, 2008-02-21 at 11:20 +0200, Yakov Lerner wrote:
> This simple patch implements eval command with printf-like syntax:
>
> eval "printf-like-format", comma-separated args
>
> The patch is against cvs-checkedout source. Suggestions are welcome.
> Implementation is very simple.
Not bad at all, for a first contribution. But I suggest
you try to limit the scope a little bit and make it still
simpler -- maybe have it accept only strings, floats and ints
to start -- and see if you can't implement it less intrusively
eg. without taking over the function for another command and
introducing new cross-module infrastructure. Then we can
maybe iteratively improve on it.
I'll give you some style and structure feedback on this one:
>
> +/* Grow allocated buffer and appens to it, without causing quadratic
> slowdown */
"append", of course -- and comments must be punctuated (in this case,
period followed by two spaces". Plus indentation -- consult the GNU
coding standard.
> +/* Grow allocated buffer and appens to it, without causing quadratic
> slowdown */
As above.
> +static void
> +eval_command (char *arg, int from_tty)
> +{
> + struct cleanup *old_cleanups;
> + char *str = gdb_own_xasprintf (arg);
> +
> + old_cleanups = make_cleanup (free_current_contents, &str);
> + execute_command (str, from_tty);
> + do_cleanups (old_chain);
> +}
old_chain is undefined. Probably should be "old_cleanups"?
Actually, except for the comment tails, you've done a commendable
job of following the coding standard. I'd like to see an implementation
that's limited enough not to require the "append" function.
Thanks,
Michael
next prev parent reply other threads:[~2008-02-21 22:11 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2008-02-21 17:33 Yakov Lerner
2008-02-21 22:37 ` Michael Snyder [this message]
2008-02-21 22:50 ` Yakov Lerner
2008-02-21 22:56 ` Michael Snyder
2008-02-22 9:59 ` Daniel Jacobowitz
2008-02-22 11:17 ` Yakov Lerner
2008-02-22 17:12 ` Eli Zaretskii
2008-02-24 15:39 ` Yakov Lerner
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=1203631895.19253.213.camel@localhost.localdomain \
--to=msnyder@specifix.com \
--cc=gdb-patches@sourceware.org \
--cc=iler.ml@gmail.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