diff options
author | Junio C Hamano <gitster@pobox.com> | 2016-03-10 11:13:47 -0800 |
---|---|---|
committer | Junio C Hamano <gitster@pobox.com> | 2016-03-10 11:13:47 -0800 |
commit | c6f399c96f5a323a11f63a54553664c596bf0e2d (patch) | |
tree | 2edc0565fedccae8a3e74adfad58adac80f8b4ba | |
parent | Merge branch 'jk/pack-idx-corruption-safety' into maint (diff) | |
parent | exec_cmd.c: use find_last_dir_sep() for code simplification (diff) | |
download | tgif-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.c | 6 |
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; } |