@matheusbsbs / matheus-bagliano / commits / cca1704897
Fork 0

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@gmx.de> Signed-off-by: Junio C Hamano <gitster@pobox.com>

Johannes Schindelin committed Jan 2, 2009 at 19:07 UTC cca1704897e7fdb182f68d4c48a437c5d7bc5203
1 file changed +2 -3
git.c
+2 -3
@@ -428,9 +428,8 @@ int main(int argc, const char **argv)
428 * name, and the dirname as the default exec_path
429 * if we don't have anything better.
430 */
431 - do
432 - --slash;
433 - while (cmd <= slash && !is_dir_sep(*slash));
431 + while (cmd <= slash && !is_dir_sep(*slash))
432 + slash--;
433 if (cmd <= slash) {
434 *slash++ = 0;
435 git_set_argv0_path(cmd);