mirror of
https://github.com/lua/lua
synced 2024-11-26 06:39:41 +03:00
better way to handle redefinitions of 'localeconv'
This commit is contained in:
parent
9cb0607f6f
commit
2622ed2528
9
llex.c
9
llex.c
@ -1,5 +1,5 @@
|
||||
/*
|
||||
** $Id: llex.c,v 2.25 2007/05/11 17:28:56 roberto Exp roberto $
|
||||
** $Id: llex.c,v 2.26 2007/08/09 20:29:15 roberto Exp roberto $
|
||||
** Lexical Analyzer
|
||||
** See Copyright Notice in lua.h
|
||||
*/
|
||||
@ -181,11 +181,14 @@ static void buffreplace (LexState *ls, char from, char to) {
|
||||
}
|
||||
|
||||
|
||||
#if !defined(getlocaledecpoint)
|
||||
#define getlocaledecpoint() (localeconv()->decimal_point[0])
|
||||
#endif
|
||||
|
||||
static void trydecpoint (LexState *ls, SemInfo *seminfo) {
|
||||
/* format error: try to update decimal point separator */
|
||||
struct lconv *cv = localeconv();
|
||||
char old = ls->decpoint;
|
||||
ls->decpoint = (cv ? cv->decimal_point[0] : '.');
|
||||
ls->decpoint = getlocaledecpoint();
|
||||
buffreplace(ls, old, ls->decpoint); /* try updated decimal separator */
|
||||
if (!luaO_str2d(luaZ_buffer(ls->buff), &seminfo->r)) {
|
||||
/* format error with correct decimal point: no more options */
|
||||
|
Loading…
Reference in New Issue
Block a user