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

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi,

On Mon, 9 Mar 2009, Jay Soffian wrote:

> On Mon, Mar 9, 2009 at 10:19 PM, Junio C Hamano <gitster@xxxxxxxxx> 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

[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]

  Powered by Linux