git/list[1] front-page[2] threads[3] people[4] search[5] about
 

Re: [PATCH] alias.c: use git_config_string() to get alias_val

From
Christian Couder <chriscool@tuxfamily.org>
Date
Apr 5, 2008, 16:19 UTC
Message-ID
<200804051819.46904.chriscool@tuxfamily.org>
In-Reply-To
<20080405121834.GB14565@leksak.fem-net>
Le samedi 5 avril 2008, Stephan Beyer a écrit :
Show 5 quoted lines
> Signed-off-by: Stephan Beyer <s-beyer@gmx.net>
> ---
> Hi,
>
> This is a `Janitor patch' to get involved ;-)
Great!
> See
> 	http://git.or.cz/gitwiki/Janitor
Did you see:

"(And no, casting the "char **" into a "const char **" is not a good solution either.)"

in the above page ?
Show 25 quoted lines
> It does not (at least, should not) change any functionality and
> it has been tested using some aliases.
>
> Regards,
> Stephan
>
>  alias.c |    8 ++------
>  1 files changed, 2 insertions(+), 6 deletions(-)
>
> diff --git a/alias.c b/alias.c
> index 116cac8..ac88d38 100644
> --- a/alias.c
> +++ b/alias.c
> @@ -4,12 +4,8 @@ static const char *alias_key;
>  static char *alias_val;
>  static int alias_lookup_cb(const char *k, const char *v)
>  {
> -	if (!prefixcmp(k, "alias.") && !strcmp(k+6, alias_key)) {
> -		if (!v)
> -			return config_error_nonbool(k);
> -		alias_val = xstrdup(v);
> -		return 0;
> -	}
> +	if (!prefixcmp(k, "alias.") && !strcmp(k+6, alias_key))
> +		return git_config_string((const char**)&alias_val, k, v);

Are you sure this ugly cast to "const char**" is needed ? Isn't there a better way to do it ?

>  	return 0;
>  }

Thanks, Christian.

Previous: Stephan BeyerNext: Stephan Beyer
Message 2 of 6 in “alias.c: use git_config_string() to get alias_val”
  1. alias.c: use git_config_string() to get alias_valStephan Beyer, Apr 5, 2008
  2. Christian CouderApr 5, 2008
  3. Stephan BeyerApr 5, 2008
  4. Christian CouderApr 6, 2008
  5. Stephan BeyerApr 6, 2008
  6. Christian CouderApr 6, 2008

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.