Skip to content

Commit

Permalink
git wrapper: Make while loop more reader-friendly
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
Johannes Schindelin authored and Junio C Hamano committed Jan 2, 2009
1 parent 3827210 commit cca1704
Showing 1 changed file with 2 additions and 3 deletions.
5 changes: 2 additions & 3 deletions git.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down

0 comments on commit cca1704

Please sign in to comment.