Andrew's git
/
gitweb.git
/ diff
summary
|
log
|
commit
| diff |
tree
commit
grep
author
committer
pickaxe
?
re
Merge branch 'ak/extract-argv0-last-dir-sep'
author
Junio C Hamano
<gitster@pobox.com>
Fri, 26 Feb 2016 21:37:12 +0000
(13:37 -0800)
committer
Junio C Hamano
<gitster@pobox.com>
Fri, 26 Feb 2016 21:37:12 +0000
(13:37 -0800)
Code simplification.
* ak/extract-argv0-last-dir-sep:
exec_cmd.c: use find_last_dir_sep() for code simplification
exec_cmd.c
patch
|
blob
|
history
raw
(from parent 1:
26f7b5c
)
diff --git
a/exec_cmd.c
b/exec_cmd.c
index e85f0fd8d897f4823a7c765d6b6ef929a15ca679..680b257cd5ae99175dc52e85a2aa4ba570c7f35b 100644
(file)
--- a/
exec_cmd.c
+++ b/
exec_cmd.c
@@
-43,12
+43,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;
}