Re: [PATCH v9 1/1] http: Add Accept-Language header if possible
- From
Junio C Hamano <gitster@pobox.com>
- Date
- Feb 25, 2015, 22:52 UTC
- Message-ID
- <xmqqpp8xmwnp.fsf@gitster.dls.corp.google.com>
- In-Reply-To
- <1422446677-8415-2-git-send-email-eungjun.yi@navercorp.com>
Yi EungJun <semtlenori@gmail.com> writes:
Show 7 quoted lines
> From: Yi EungJun <eungjun.yi@navercorp.com> > > Add an Accept-Language header which indicates the user's preferred > languages defined by $LANGUAGE, $LC_ALL, $LC_MESSAGES and $LANG. > ... > Signed-off-by: Yi EungJun <eungjun.yi@navercorp.com> > ---
Yikes.
This is now in 'master', but I wonder if people are getting compilation errors because of this change. I do.
It introduces a call to setlocale() without causing <locale.h> to be included, and runs afoul of -Wimplicit-function-declaration.
Other call sites of setlocale() are in gettext.c, which does include the header at the beginning.
Show 12 quoted lines
> diff --git a/http.c b/http.c > index 040f362..b2ad2a8 100644 > --- a/http.c > +++ b/http.c > ... > +#ifndef NO_GETTEXT > + retval = setlocale(LC_MESSAGES, NULL); > + if (retval && *retval && > + strcmp(retval, "C") && > + strcmp(retval, "POSIX")) > + return retval; > +#endif
I really do not like a conditional inclusion of system header files inside any *.c file, but here is a minimum emergency fix-up I am running with today. It should go to somewhere in git-compat-util.h.
Somebody care to throw a tested fix-up patch at me?
Thanks.
http.c | 4 ++++ 1 file changed, 4 insertions(+)
diff --git a/http.c b/http.c index efdab09..7e79cbd 100644 --- a/http.c +++ b/http.c @@ -9,6 +9,10 @@ #include "version.h" #include "pkt-line.h" +#ifndef NO_GETTEXT +#include <locale.h> +#endif + int active_requests; int http_is_verbose; size_t http_post_buffer = 16 * LARGE_PACKET_MAX;