Skip to content

Commit c6f399c

Browse files
committed
Merge branch 'ak/extract-argv0-last-dir-sep' into maint
Code simplification. * ak/extract-argv0-last-dir-sep: exec_cmd.c: use find_last_dir_sep() for code simplification
2 parents 80047fa + f459823 commit c6f399c

File tree

1 file changed

+2
-4
lines changed

1 file changed

+2
-4
lines changed

exec_cmd.c

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -44,12 +44,10 @@ const char *git_extract_argv0_path(const char *argv0)
4444

4545
if (!argv0 || !*argv0)
4646
return NULL;
47-
slash = argv0 + strlen(argv0);
4847

49-
while (argv0 <= slash && !is_dir_sep(*slash))
50-
slash--;
48+
slash = find_last_dir_sep(argv0);
5149

52-
if (slash >= argv0) {
50+
if (slash) {
5351
argv0_path = xstrndup(argv0, slash - argv0);
5452
return slash + 1;
5553
}

0 commit comments

Comments
 (0)