mirror of
https://github.com/git/git.git
synced 2024-11-27 20:14:30 +08:00
git_extract_argv0_path(): Move check for valid argv0 from caller to callee
This simplifies the calling code. Signed-off-by: Steffen Prohaska <prohaska@zib.de> Acked-by: Johannes Sixt <j6t@kdbg.org> Signed-off-by: Junio C Hamano <gitster@pobox.com>
This commit is contained in:
parent
4dd47c3b86
commit
2cd72b0b29
@ -22,7 +22,11 @@ const char *system_path(const char *path)
|
|||||||
|
|
||||||
const char *git_extract_argv0_path(const char *argv0)
|
const char *git_extract_argv0_path(const char *argv0)
|
||||||
{
|
{
|
||||||
const char *slash = argv0 + strlen(argv0);
|
const char *slash;
|
||||||
|
|
||||||
|
if (!argv0 || !*argv0)
|
||||||
|
return NULL;
|
||||||
|
slash = argv0 + strlen(argv0);
|
||||||
|
|
||||||
while (argv0 <= slash && !is_dir_sep(*slash))
|
while (argv0 <= slash && !is_dir_sep(*slash))
|
||||||
slash--;
|
slash--;
|
||||||
|
Loading…
Reference in New Issue
Block a user