Re: [PATCH 0/10] towards clean leak-checker output
- From
Junio C Hamano <gitster@pobox.com>
- Date
- Sep 6, 2017, 01:42 UTC
- Message-ID
- <xmqqd174a9hs.fsf@gitster.mtv.corp.google.com>
- In-Reply-To
- <20170905190212.4xx4xukx2bbtudij@sigill.intra.peff.net>
Jeff King <peff@peff.net> writes:
Show 36 quoted lines
> In fact, the whole extract_argv0_path thing is pointless without
> RUNTIME_PREFIX. So I think one reasonable fix is just:
>
> diff --git a/exec_cmd.c b/exec_cmd.c
> index fb94aeba9c..09f05c3bc3 100644
> --- a/exec_cmd.c
> +++ b/exec_cmd.c
> @@ -5,7 +5,10 @@
> #define MAX_ARGS 32
>
> static const char *argv_exec_path;
> +
> +#ifdef RUNTIME_PREFIX
> static const char *argv0_path;
> +#endif
>
> char *system_path(const char *path)
> {
> @@ -40,6 +43,7 @@ char *system_path(const char *path)
>
> void git_extract_argv0_path(const char *argv0)
> {
> +#ifdef RUNTIME_PREFIX
> const char *slash;
>
> if (!argv0 || !*argv0)
> @@ -49,6 +53,7 @@ void git_extract_argv0_path(const char *argv0)
>
> if (slash)
> argv0_path = xstrndup(argv0, slash - argv0);
> +#endif
> }
>
> void git_set_argv_exec_path(const char *exec_path)
>
> -PeffYeah, I kind of like this (I would have reduced the ifdef noise by leaving a totally-unused argv0_path in the BSS, though).