diff options
| author | Roberto Ierusalimschy <roberto@inf.puc-rio.br> | 2015-04-03 15:41:57 -0300 |
|---|---|---|
| committer | Roberto Ierusalimschy <roberto@inf.puc-rio.br> | 2015-04-03 15:41:57 -0300 |
| commit | 48d0674c2e85ef7bb447a8a45fbc6af80508f10e (patch) | |
| tree | 9d7b34ea077dfbe155866c9b87ae47ba901b2a7e /lstrlib.c | |
| parent | 6ffe006f5c57321a9b3c12a246b142a0394bf62d (diff) | |
| download | lua-48d0674c2e85ef7bb447a8a45fbc6af80508f10e.tar.gz lua-48d0674c2e85ef7bb447a8a45fbc6af80508f10e.tar.bz2 lua-48d0674c2e85ef7bb447a8a45fbc6af80508f10e.zip | |
more consistent use of locale radix character across Lua
Diffstat (limited to 'lstrlib.c')
| -rw-r--r-- | lstrlib.c | 5 |
1 files changed, 3 insertions, 2 deletions
| @@ -1,5 +1,5 @@ | |||
| 1 | /* | 1 | /* |
| 2 | ** $Id: lstrlib.c,v 1.226 2015/02/09 18:05:46 roberto Exp roberto $ | 2 | ** $Id: lstrlib.c,v 1.227 2015/03/28 19:14:47 roberto Exp roberto $ |
| 3 | ** Standard library for string operations and pattern-matching | 3 | ** Standard library for string operations and pattern-matching |
| 4 | ** See Copyright Notice in lua.h | 4 | ** See Copyright Notice in lua.h |
| 5 | */ | 5 | */ |
| @@ -803,6 +803,7 @@ static int str_gsub (lua_State *L) { | |||
| 803 | ** Hexadecimal floating-point formatter | 803 | ** Hexadecimal floating-point formatter |
| 804 | */ | 804 | */ |
| 805 | 805 | ||
| 806 | #include <locale.h> | ||
| 806 | #include <math.h> | 807 | #include <math.h> |
| 807 | 808 | ||
| 808 | #define SIZELENMOD (sizeof(LUA_NUMBER_FRMLEN)/sizeof(char)) | 809 | #define SIZELENMOD (sizeof(LUA_NUMBER_FRMLEN)/sizeof(char)) |
| @@ -850,7 +851,7 @@ static int num2straux (char *buff, lua_Number x) { | |||
| 850 | m = adddigit(buff, n++, m * (1 << L_NBFD)); /* add first digit */ | 851 | m = adddigit(buff, n++, m * (1 << L_NBFD)); /* add first digit */ |
| 851 | e -= L_NBFD; /* this digit goes before the radix point */ | 852 | e -= L_NBFD; /* this digit goes before the radix point */ |
| 852 | if (m > 0) { /* more digits? */ | 853 | if (m > 0) { /* more digits? */ |
| 853 | buff[n++] = '.'; /* add radix point */ | 854 | buff[n++] = lua_getlocaledecpoint(); /* add radix point */ |
| 854 | do { /* add as many digits as needed */ | 855 | do { /* add as many digits as needed */ |
| 855 | m = adddigit(buff, n++, m * 16); | 856 | m = adddigit(buff, n++, m * 16); |
| 856 | } while (m > 0); | 857 | } while (m > 0); |
