Re: [PATCH v2] Allow HTTP user agent string to be modified.

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

 



On Sun, 2010-08-08 at 10:51 +0800, Tay Ray Chuan wrote:

> >  static char *user_name, *user_pass;
> > +static const char *user_agent = NULL;
> 
> This can be skipped, I think.

My only reason for wanting to initialize is because I don't trust all
compilers to follow the standard.  But, since there are so many other
instances of relying on the compiler to zero out static vars in other
places already, I don't have any problem with conforming...


> 
> >[snip]
> > @@ -279,7 +283,10 @@ static CURL *get_curl_handle(void)
> >        if (getenv("GIT_CURL_VERBOSE"))
> >                curl_easy_setopt(result, CURLOPT_VERBOSE, 1);
> >
> > -       curl_easy_setopt(result, CURLOPT_USERAGENT, GIT_USER_AGENT);
> > +       if (user_agent != NULL)
> > +               curl_easy_setopt(result, CURLOPT_USERAGENT, user_agent);
> > +       else
> > +               curl_easy_setopt(result, CURLOPT_USERAGENT, GIT_USER_AGENT);
> 
> Hmm, perhaps
> 
>     curl_easy_setopt(result, CURLOPT_USERAGENT,
>         user_agent ? user_agent : GIT_USER_AGENT);
> 
> to replace the if-else?

That is perfectly fine with me.



--
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[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]