All of lore.kernel.org
 help / color / mirror / Atom feed
From: "Yoshinori K. Okuji" <okuji@enbug.org>
To: The development of GRUB 2 <grub-devel@gnu.org>
Subject: Re: [PATCH] Test command
Date: Wed, 15 Apr 2009 00:55:36 +0900	[thread overview]
Message-ID: <200904150055.36476.okuji@enbug.org> (raw)
In-Reply-To: <49E0B331.4010305@gmail.com>

On Sunday 12 April 2009 00:11:45 phcoder wrote:
> Updated. Same changelog
>
> >> +       {
> >> +         update_val (grub_strcmp (args[*argn], args[*argn + 2]) == 0);
> >> +         (*argn) += 3;
> >
> > I myself feel that these parentheses are redundant, but I don't know how
> > others think. For C programmers, it is well known that * has a very high
> > priority.
>
> These parenthesis are necessary if doing sth like
> (*argn)++
> since ++ and += are logically and visually similar I prefer to put the
> parenthesis

OK.

>
> > Getting tired, so I skip the same criticism from here.
>
> Actually it would have been enough to say "same applies further on in
> patch"
>
> >> +      if (*argn + 1 < argc && !grub_strcmp (args[*argn], "-s"))
> >> +       {
> >> +         grub_file_t file;
> >> +         file = grub_file_open (args[*argn + 1]);
> >> +         update_val (file && grub_file_size (file));
> >
> > This is not very safe, because grub_file_size returns grub_off_t which is
> > a 64-bit unsigned int. By converting it into 32-bit signed int
> > implicitly, the result can be zero, even when the size is not zero. So it
> > is better to say explicitly, != 0.


BTW, I think you can simplify test_parse. For example, you write "if (*argn + 
2 < argc ...)" many times, but it should be possible to test this condition 
only once per loop.

Regards,
Okuji



  reply	other threads:[~2009-04-14 15:55 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-02-13 11:39 Test command phcoder
2009-02-13 11:39 ` [PATCH] " phcoder
2009-04-10 22:18   ` phcoder
2009-04-11 10:07     ` Yoshinori K. Okuji
2009-04-11 15:11       ` phcoder
2009-04-14 15:55         ` Yoshinori K. Okuji [this message]
2009-04-16 13:15           ` phcoder
2009-04-25 12:29             ` Vladimir Serbinenko

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=200904150055.36476.okuji@enbug.org \
    --to=okuji@enbug.org \
    --cc=grub-devel@gnu.org \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.