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 /liolib.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 'liolib.c')
| -rw-r--r-- | liolib.c | 13 |
1 files changed, 4 insertions, 9 deletions
| @@ -1,5 +1,5 @@ | |||
| 1 | /* | 1 | /* |
| 2 | ** $Id: liolib.c,v 2.142 2015/01/02 12:50:28 roberto Exp roberto $ | 2 | ** $Id: liolib.c,v 2.143 2015/03/06 19:09:08 roberto Exp roberto $ |
| 3 | ** Standard I/O (and system) library | 3 | ** Standard I/O (and system) library |
| 4 | ** See Copyright Notice in lua.h | 4 | ** See Copyright Notice in lua.h |
| 5 | */ | 5 | */ |
| @@ -410,12 +410,6 @@ static int readdigits (RN *rn, int hex) { | |||
| 410 | } | 410 | } |
| 411 | 411 | ||
| 412 | 412 | ||
| 413 | /* access to locale "radix character" (decimal point) */ | ||
| 414 | #if !defined(l_getlocaledecpoint) | ||
| 415 | #define l_getlocaledecpoint() (localeconv()->decimal_point[0]) | ||
| 416 | #endif | ||
| 417 | |||
| 418 | |||
| 419 | /* | 413 | /* |
| 420 | ** Read a number: first reads a valid prefix of a numeral into a buffer. | 414 | ** Read a number: first reads a valid prefix of a numeral into a buffer. |
| 421 | ** Then it calls 'lua_stringtonumber' to check whether the format is | 415 | ** Then it calls 'lua_stringtonumber' to check whether the format is |
| @@ -425,9 +419,10 @@ static int read_number (lua_State *L, FILE *f) { | |||
| 425 | RN rn; | 419 | RN rn; |
| 426 | int count = 0; | 420 | int count = 0; |
| 427 | int hex = 0; | 421 | int hex = 0; |
| 428 | char decp[2] = "."; | 422 | char decp[2]; |
| 429 | rn.f = f; rn.n = 0; | 423 | rn.f = f; rn.n = 0; |
| 430 | decp[0] = l_getlocaledecpoint(); /* get decimal point from locale */ | 424 | decp[0] = lua_getlocaledecpoint(); /* get decimal point from locale */ |
| 425 | decp[1] = '\0'; | ||
| 431 | l_lockfile(rn.f); | 426 | l_lockfile(rn.f); |
| 432 | do { rn.c = l_getc(rn.f); } while (isspace(rn.c)); /* skip spaces */ | 427 | do { rn.c = l_getc(rn.f); } while (isspace(rn.c)); /* skip spaces */ |
| 433 | test2(&rn, "-+"); /* optional signal */ | 428 | test2(&rn, "-+"); /* optional signal */ |
