Re: [PATCH] diff.c: guard config parser from value=NULL
- From
Christian Couder <chriscool@tuxfamily.org>
- Date
- Feb 11, 2008, 04:55 UTC
- Message-ID
- <200802110555.19383.chriscool@tuxfamily.org>
- In-Reply-To
- <20080210190145.GB5129@artemis.madism.org>
Le dimanche 10 février 2008, Pierre Habouzit a écrit :
Show 6 quoted lines
> On Sun, Feb 10, 2008 at 06:35:34PM +0000, Christian Couder wrote: > > +static int xstrdup_confval(const char *dest, const char *var, const > > char *value) > > Why not calling that "git_config_string" in config.[hc] and be > API-consistent ?
In this function, there is:
if (!value || !*value)
return error("%s: lacks value", var);but in some places an empty string is not an error, and in some other places we "die" in case of error instead of using "return error..." So I am not sure this function can be generally usefull as it is now.
Maybe I should add a flag parameter to control if we should "die" or "return error" and if we should accept an empty string or not.
What do you think ?
Christian.