summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLibravatar Junio C Hamano <gitster@pobox.com>2016-03-10 11:13:47 -0800
committerLibravatar Junio C Hamano <gitster@pobox.com>2016-03-10 11:13:47 -0800
commitc6f399c96f5a323a11f63a54553664c596bf0e2d (patch)
tree2edc0565fedccae8a3e74adfad58adac80f8b4ba
parentMerge branch 'jk/pack-idx-corruption-safety' into maint (diff)
parentexec_cmd.c: use find_last_dir_sep() for code simplification (diff)
downloadtgif-c6f399c96f5a323a11f63a54553664c596bf0e2d.tar.xz
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
-rw-r--r--exec_cmd.c6
1 files changed, 2 insertions, 4 deletions
diff --git a/exec_cmd.c b/exec_cmd.c
index cf442a97f8..9d5703a157 100644
--- a/exec_cmd.c
+++ b/exec_cmd.c
@@ -44,12 +44,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;
}