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
This commit is contained in:
commit
c6f399c96f
@ -44,12 +44,10 @@ const char *git_extract_argv0_path(const char *argv0)
|
|||||||
|
|
||||||
if (!argv0 || !*argv0)
|
if (!argv0 || !*argv0)
|
||||||
return NULL;
|
return NULL;
|
||||||
slash = argv0 + strlen(argv0);
|
|
||||||
|
|
||||||
while (argv0 <= slash && !is_dir_sep(*slash))
|
slash = find_last_dir_sep(argv0);
|
||||||
slash--;
|
|
||||||
|
|
||||||
if (slash >= argv0) {
|
if (slash) {
|
||||||
argv0_path = xstrndup(argv0, slash - argv0);
|
argv0_path = xstrndup(argv0, slash - argv0);
|
||||||
return slash + 1;
|
return slash + 1;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user