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

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.
Previous: Pierre HabouzitNext: Martin Koegler
Message 3 of 4 in “diff.c: guard config parser from value=NULL”
  1. diff.c: guard config parser from value=NULLChristian Couder, Feb 10, 2008
  2. Pierre HabouzitFeb 10, 2008
  3. Christian CouderFeb 11, 2008
  4. Martin KoeglerFeb 10, 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.