Re: [PATCH v3] http: Add Accept-Language header if possible

2014-07-13 Thread Yi, EungJun
2014-07-14 1:57 GMT+09:00 Junio C Hamano : > > If you do not want floating point (and I think we tend to avoid it > when we do not need it), you can realize that in your use of "0.1" > and "0.01" and "0.001" there is nothing fundamentally floating-point; > you can measure how many digits below the

Re: [PATCH v3] http: Add Accept-Language header if possible

2014-07-13 Thread Junio C Hamano
"Yi, EungJun" writes: > I think it is possible like this: > > num_langs += 1; /* for '*' */ > decimal_places = 1 + (num_langs > 10) + (num_langs > 100); > snprintf(q_format, sizeof(q_format), "; q=%%.%df", decimal_places); > for (q_precision = 1.0; decimal_places-- > 0;) q_precisi

Re: [PATCH v3] http: Add Accept-Language header if possible

2014-07-13 Thread Yi, EungJun
2014-07-13 13:26 GMT+09:00 Eric Sunshine : >> + /* Decide the precision for q-factor on number of preferred >> languages. */ >> + if (num_langs + 1 > 100) { /* +1 is for '*' */ >> + q_precision = 0.001; >> + q_format = "; q=%.3f"; >> + } else if (num_l

Re: [PATCH v3] http: Add Accept-Language header if possible

2014-07-12 Thread Eric Sunshine
On Fri, Jul 11, 2014 at 12:52 PM, Yi EungJun wrote: > Add an Accept-Language header which indicates the user's preferred > languages defined by $LANGUAGE, $LC_ALL, $LC_MESSAGES and $LANG. > > Examples: > LANGUAGE= -> "" > LANGUAGE=ko:en -> "Accept-Language: ko, en; q=0.9, *; q=0.1" > LANGUAG

Re: [PATCH v3] http: Add Accept-Language header if possible

2014-07-12 Thread Yi, EungJun
Thanks for your detailed review and nice suggestions. I will accept most of them. 2014-07-12 2:35 GMT+09:00 Jeff King : >> + /* Decide the precision for q-factor on number of preferred languages. >> */ >> + if (num_langs + 1 > 100) { /* +1 is for '*' */ >> + q_precision = 0.00

Re: [PATCH v3] http: Add Accept-Language header if possible

2014-07-12 Thread Peter Krefting
Yi EungJun: Add an Accept-Language header which indicates the user's preferred languages defined by $LANGUAGE, $LC_ALL, $LC_MESSAGES and $LANG. This one seems to fix all the issues I had with the first patch, thanks! -- \\// Peter - http://www.softwolves.pp.se/ -- To unsubscribe from this l

Re: [PATCH v3] http: Add Accept-Language header if possible

2014-07-11 Thread Eric Sunshine
On Fri, Jul 11, 2014 at 1:35 PM, Jeff King wrote: > On Sat, Jul 12, 2014 at 01:52:53AM +0900, Yi EungJun wrote: >> Add an Accept-Language header which indicates the user's preferred >> languages defined by $LANGUAGE, $LC_ALL, $LC_MESSAGES and $LANG. >> >> Examples: >> LANGUAGE= -> "" >> LANGUA

Re: [PATCH v3] http: Add Accept-Language header if possible

2014-07-11 Thread Jeff King
On Sat, Jul 12, 2014 at 01:52:53AM +0900, Yi EungJun wrote: > Add an Accept-Language header which indicates the user's preferred > languages defined by $LANGUAGE, $LC_ALL, $LC_MESSAGES and $LANG. > > Examples: > LANGUAGE= -> "" > LANGUAGE=ko:en -> "Accept-Language: ko, en; q=0.9, *; q=0.1" >

[PATCH v3] http: Add Accept-Language header if possible

2014-07-11 Thread Yi EungJun
Add an Accept-Language header which indicates the user's preferred languages defined by $LANGUAGE, $LC_ALL, $LC_MESSAGES and $LANG. Examples: LANGUAGE= -> "" LANGUAGE=ko:en -> "Accept-Language: ko, en; q=0.9, *; q=0.1" LANGUAGE=ko LANG=en_US.UTF-8 -> "Accept-Language: ko, *; q=0.1" LANGUAG