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-github-48d0674c2e85ef7bb447a8a45fbc6af80508f10e.tar.gz |
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 @@ /* -** $Id: liolib.c,v 2.142 2015/01/02 12:50:28 roberto Exp roberto $ +** $Id: liolib.c,v 2.143 2015/03/06 19:09:08 roberto Exp roberto $ ** Standard I/O (and system) library ** See Copyright Notice in lua.h */ @@ -410,12 +410,6 @@ static int readdigits (RN *rn, int hex) { } -/* access to locale "radix character" (decimal point) */ -#if !defined(l_getlocaledecpoint) -#define l_getlocaledecpoint() (localeconv()->decimal_point[0]) -#endif - - /* ** Read a number: first reads a valid prefix of a numeral into a buffer. ** Then it calls 'lua_stringtonumber' to check whether the format is @@ -425,9 +419,10 @@ static int read_number (lua_State *L, FILE *f) { RN rn; int count = 0; int hex = 0; - char decp[2] = "."; + char decp[2]; rn.f = f; rn.n = 0; - decp[0] = l_getlocaledecpoint(); /* get decimal point from locale */ + decp[0] = lua_getlocaledecpoint(); /* get decimal point from locale */ + decp[1] = '\0'; l_lockfile(rn.f); do { rn.c = l_getc(rn.f); } while (isspace(rn.c)); /* skip spaces */ test2(&rn, "-+"); /* optional signal */ |