Re: [PATCH v9 1/1] http: Add Accept-Language header if possible

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

 



Yi EungJun <semtlenori@xxxxxxxxx> writes:

> From: Yi EungJun <eungjun.yi@xxxxxxxxxxxxx>
>
> 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@xxxxxxxxxxxxx>
> ---

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.

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