Skip to content

Commit

Permalink
Merge branch 'ak/extract-argv0-last-dir-sep'
Browse files Browse the repository at this point in the history
Code simplification.

* ak/extract-argv0-last-dir-sep:
  exec_cmd.c: use find_last_dir_sep() for code simplification
  • Loading branch information
Junio C Hamano committed Feb 26, 2016
2 parents 26f7b5c + f459823 commit 7943cba
Showing 1 changed file with 2 additions and 4 deletions.
6 changes: 2 additions & 4 deletions exec_cmd.c
Original file line number Diff line number Diff line change
Expand Up @@ -43,12 +43,10 @@ const char *git_extract_argv0_path(const char *argv0)

if (!argv0 || !*argv0)
return NULL;
slash = argv0 + strlen(argv0);

while (argv0 <= slash && !is_dir_sep(*slash))
slash--;
slash = find_last_dir_sep(argv0);

if (slash >= argv0) {
if (slash) {
argv0_path = xstrndup(argv0, slash - argv0);
return slash + 1;
}
Expand Down

0 comments on commit 7943cba

Please sign in to comment.