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>
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))
slash--;
{
const char *cmd;
- if (argv[0] && *argv[0])
- cmd = git_extract_argv0_path(argv[0]);
- else
+ cmd = git_extract_argv0_path(argv[0]);
+ if (!cmd)
cmd = "git-help";
/*