git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Christian Couder <chriscool@tuxfamily.org>
To: Stephan Beyer <s-beyer@gmx.net>
Cc: git@vger.kernel.org
Subject: Re: [PATCH] alias.c: use git_config_string() to get alias_val
Date: Sat, 5 Apr 2008 18:19:46 +0200	[thread overview]
Message-ID: <200804051819.46904.chriscool@tuxfamily.org> (raw)
In-Reply-To: <20080405121834.GB14565@leksak.fem-net>

Le samedi 5 avril 2008, Stephan Beyer a écrit :
> 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 ?

> 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.

  reply	other threads:[~2008-04-05 16:15 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-04-05 12:18 [PATCH] alias.c: use git_config_string() to get alias_val Stephan Beyer
2008-04-05 16:19 ` Christian Couder [this message]
2008-04-05 17:39   ` Stephan Beyer
2008-04-06  5:49     ` Christian Couder
2008-04-06 11:02       ` Stephan Beyer
2008-04-06 13:29         ` Christian Couder

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=200804051819.46904.chriscool@tuxfamily.org \
    --to=chriscool@tuxfamily.org \
    --cc=git@vger.kernel.org \
    --cc=s-beyer@gmx.net \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).