summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJunio C Hamano <gitster@pobox.com>2016-03-10 11:13:47 -0800
committerJunio C Hamano <gitster@pobox.com>2016-03-10 11:13:47 -0800
commitc6f399c96f5a323a11f63a54553664c596bf0e2d (patch)
tree2edc0565fedccae8a3e74adfad58adac80f8b4ba
parent80047fa084f994969d42338bc3fbbb89e7d957d6 (diff)
parentf45982337aab3b3d289692027ce00b130b967ffa (diff)
downloadgit-c6f399c96f5a323a11f63a54553664c596bf0e2d.tar.gz
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;
}