Git development
 help / color / mirror / Atom feed
* [CLEANUP PATCH RESEND] git wrapper: Make while loop more reader-friendly
@ 2009-01-02 18:07 Johannes Schindelin
  2009-01-02 18:28 ` Boyd Stephen Smith Jr.
  0 siblings, 1 reply; 4+ messages in thread
From: Johannes Schindelin @ 2009-01-02 18:07 UTC (permalink / raw)
  To: git, gitster


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 940a498..e0d9071 100644
--- a/git.c
+++ b/git.c
@@ -428,9 +428,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 (cmd <= slash) {
 		*slash++ = 0;
 		git_set_argv0_path(cmd);
-- 
1.6.1.rc3.224.g95ac9

^ permalink raw reply related	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2009-01-02 20:05 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2009-01-02 18:07 [CLEANUP PATCH RESEND] git wrapper: Make while loop more reader-friendly Johannes Schindelin
2009-01-02 18:28 ` Boyd Stephen Smith Jr.
2009-01-02 18:49   ` Johannes Schindelin
2009-01-02 20:04     ` Boyd Stephen Smith Jr.

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox