lists.zerezo.com
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PATCH 1/2] git wrapper: Make while loop more reader-friendly
- Date: Mon, 25 Aug 2008 22:51:25 +0200 (CEST)
- From: Johannes Schindelin <Johannes.Schindelin@xxxxxx>
- Subject: [PATCH 1/2] git wrapper: Make while loop more reader-friendly
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@xxxxxx>
---
The original version threatened to cause eye-cancer with this
developer, so that I had to run to the physician real quick.
That was quite hard, as no ophtalmologist seemed to be in
office at 10:30pm. But I found a real good witch, and she
diagnozed me as healthy.
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
--
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
- References:
- [PATCH] "git shell" won't work, need "git-shell"
- Re: [PATCH] "git shell" won't work, need "git-shell"
- Re: [PATCH] "git shell" won't work, need "git-shell"
- Re: [PATCH] "git shell" won't work, need "git-shell"
- Re: [PATCH] "git shell" won't work, need "git-shell"
- Re: [PATCH] "git shell" won't work, need "git-shell"
- From: Johannes Schindelin
- Re: [PATCH] "git shell" won't work, need "git-shell"
- Re: [PATCH] "git shell" won't work, need "git-shell"
- From: Johannes Schindelin
- Re: [PATCH] "git shell" won't work, need "git-shell"
- Re: [PATCH] "git shell" won't work, need "git-shell"
- From: Johannes Schindelin
- Re: [PATCH] "git shell" won't work, need "git-shell"
- From: Johannes Schindelin