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

Re: [RFH Patch 2/2] http_init(): Fix config file parsing

From
Johannes Schindelin <johannes.schindelin@gmx.de>
Date
Mar 10, 2009, 11:07 UTC
Message-ID
<alpine.DEB.1.00.0903101206440.14295@intel-tinevez-2-302>
In-Reply-To
<76718490903092005n66bca743t67eb7f0ff830d9d7@mail.gmail.com>
Hi,
On Mon, 9 Mar 2009, Jay Soffian wrote:
Show 29 quoted lines
> On Mon, Mar 9, 2009 at 10:19 PM, Junio C Hamano <gitster@pobox.com> wrote:
> 
> > @@ -241,14 +221,18 @@ void http_init(struct remote *remote)
> >        if (getenv("GIT_SSL_NO_VERIFY"))
> >                curl_ssl_verify = 0;
> >
> > -       ssl_cert = getenv("GIT_SSL_CERT");
> > +       if (getenv("GIT_SSL_CERT"))
> > +               ssl_cert = getenv("GIT_SSL_CERT");
> >  #if LIBCURL_VERSION_NUM >= 0x070902
> > -       ssl_key = getenv("GIT_SSL_KEY");
> > +       if (getenv("GIT_SSL_KEY"))
> > +               ssl_key = getenv("GIT_SSL_KEY");
> >  #endif
> >  #if LIBCURL_VERSION_NUM >= 0x070908
> > -       ssl_capath = getenv("GIT_SSL_CAPATH");
> > +       if (getenv("GIT_SSL_CAPATH"))
> > +               ssl_capath = getenv("GIT_SSL_CAPATH");
> >  #endif
> > -       ssl_cainfo = getenv("GIT_SSL_CAINFO");
> > +       if (getenv("GIT_SSL_CAINFO"))
> > +               ssl_cainfo = getenv("GIT_SSL_CAINFO");
> 
> Would these be a little cleaner with a temporary variable. e.g.
> 
> char *value;
> 
> if ((value = getenv("GIT_SSL_CERT")))
>     ssl_cert = value;
Nah, you should go the full nine yards right away:
static void set_from_env(const char **variable, const char *name)
{
	const char *value = getenv(name);
	if (value)
		*variable = value;
}

Ciao, Dscho

Previous: Jay Soffian
Message 3 of 3 in “http_init(): Fix config file parsing”
  1. 2/2 http_init(): Fix config file parsingJunio C Hamano, Mar 10, 2009
  2. Jay SoffianMar 10, 2009
  3. Johannes SchindelinMar 10, 2009

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.