From: Christian Couder Date: Sat, 05 Apr 2008 16:19:46 GMT Subject: Re: [PATCH] alias.c: use git_config_string() to get alias_val Message-ID: <200804051819.46904.chriscool@tuxfamily.org> In-Reply-To: <20080405121834.GB14565@leksak.fem-net> Le samedi 5 avril 2008, Stephan Beyer a écrit : > Signed-off-by: Stephan Beyer > --- > 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.