From: "Mike Ralphson" <mike.ralphson@gmail.com>
To: "Johannes Schindelin" <Johannes.Schindelin@gmx.de>
Cc: "Mikael Magnusson" <mikachu@gmail.com>,
"Johannes Sixt" <johannes.sixt@telecom.at>,
"Paolo Bonzini" <bonzini@gnu.org>,
"Tommi Virtanen" <tv@eagain.net>,
"Junio C Hamano" <gitster@pobox.com>,
"Git Mailing List" <git@vger.kernel.org>
Subject: Re: [PATCH 1/2] git wrapper: Make while loop more reader-friendly
Date: Tue, 26 Aug 2008 09:50:34 +0100 [thread overview]
Message-ID: <e2b179460808260150p15b7da0ev913eced3709c2cd1@mail.gmail.com> (raw)
In-Reply-To: <alpine.DEB.1.00.0808252248150.24820@pacific.mpi-cbg.de.mpi-cbg.de>
2008/8/25 Johannes Schindelin <Johannes.Schindelin@gmx.de>:
>
> It is not a good practice to prefer performance over readability in
> something as performance uncritical as finding the trailing slash
> of argv[0].
>
> So avoid head-scratching by making the loop user-readable, and not
> hyper-performance-optimized.
>
> Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
> ---
>
> git.c | 5 ++---
> 1 files changed, 2 insertions(+), 3 deletions(-)
>
> diff --git a/git.c b/git.c
> index a647741..2fd74c4 100644
> --- a/git.c
> +++ b/git.c
> @@ -427,9 +427,8 @@ int main(int argc, const char **argv)
> * name, and the dirname as the default exec_path
> * if we don't have anything better.
> */
> - do
> - --slash;
> - while (cmd <= slash && !is_dir_sep(*slash));
> + while (cmd <= slash && !is_dir_sep(*slash))
> + slash--;
> if (slash < cmd) {
> cmd = lookup_program_in_path(cmd);
> for (slash = (char *)cmd + strlen(cmd) - 1;
> --
> 1.6.0.211.ga840e.dirty
Isn't it more likely that this form was chosen to indicate that the
loop body was expected to execute at least once, rather than zero or
more times?
Mike
next prev parent reply other threads:[~2008-08-26 8:51 UTC|newest]
Thread overview: 28+ messages / expand[flat|nested] mbox.gz Atom feed top
2008-08-24 20:23 [PATCH] "git shell" won't work, need "git-shell" Tommi Virtanen
2008-08-24 20:36 ` Junio C Hamano
2008-08-24 20:38 ` Tommi Virtanen
2008-08-24 21:20 ` Junio C Hamano
2008-08-24 22:25 ` Tommi Virtanen
2008-08-25 10:37 ` Johannes Schindelin
2008-08-25 11:44 ` Paolo Bonzini
2008-08-25 17:58 ` Johannes Schindelin
2008-08-25 18:25 ` Mikael Magnusson
2008-08-25 20:08 ` Johannes Schindelin
2008-08-25 20:28 ` Johannes Schindelin
2008-08-25 20:51 ` [PATCH 1/2] git wrapper: Make while loop more reader-friendly Johannes Schindelin
2008-08-25 20:52 ` [PATCH 2/2] git wrapper: execute git-shell when argv[1] is '-c' Johannes Schindelin
2008-08-25 21:03 ` Tommi Virtanen
2008-08-25 22:05 ` Johannes Schindelin
2008-08-25 22:20 ` Tommi Virtanen
2008-08-26 0:52 ` Johannes Schindelin
2008-08-26 6:53 ` Matthieu Moy
2008-08-26 17:43 ` Junio C Hamano
2008-08-26 8:50 ` Mike Ralphson [this message]
2008-08-25 17:08 ` [PATCH] "git shell" won't work, need "git-shell" Petr Baudis
2008-08-25 17:20 ` Dmitry Potapov
2008-08-25 17:26 ` Tommi Virtanen
2008-08-25 17:53 ` Dmitry Potapov
2008-08-25 18:17 ` Johannes Schindelin
2008-08-25 20:26 ` Dmitry Potapov
2008-08-25 20:40 ` Mike Hommey
2008-10-28 11:11 ` Dmitry V. Levin
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=e2b179460808260150p15b7da0ev913eced3709c2cd1@mail.gmail.com \
--to=mike.ralphson@gmail.com \
--cc=Johannes.Schindelin@gmx.de \
--cc=bonzini@gnu.org \
--cc=git@vger.kernel.org \
--cc=gitster@pobox.com \
--cc=johannes.sixt@telecom.at \
--cc=mikachu@gmail.com \
--cc=tv@eagain.net \
/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;
as well as URLs for NNTP newsgroup(s).