diff options
Diffstat (limited to 'libs/liblua/src/liolib.c')
-rw-r--r-- | libs/liblua/src/liolib.c | 17 |
1 files changed, 10 insertions, 7 deletions
diff --git a/libs/liblua/src/liolib.c b/libs/liblua/src/liolib.c index aa78e593fa..8491edca39 100644 --- a/libs/liblua/src/liolib.c +++ b/libs/liblua/src/liolib.c @@ -1,5 +1,5 @@ /* -** $Id: liolib.c,v 2.149 2016/05/02 14:03:19 roberto Exp $ +** $Id: liolib.c,v 2.150 2016/09/01 16:14:56 roberto Exp roberto $ ** Standard I/O (and system) library ** See Copyright Notice in lua.h */ @@ -37,10 +37,11 @@ #endif /* Check whether 'mode' matches '[rwa]%+?[L_MODEEXT]*' */ -#define l_checkmode(mode) \ - (*mode != '\0' && strchr("rwa", *(mode++)) != NULL && \ - (*mode != '+' || (++mode, 1)) && /* skip if char is '+' */ \ - (strspn(mode, L_MODEEXT) == strlen(mode))) +static int l_checkmode (const char *mode) { + return (*mode != '\0' && strchr("rwa", *(mode++)) != NULL && + (*mode != '+' || (++mode, 1)) && /* skip if char is '+' */ + (strspn(mode, L_MODEEXT) == strlen(mode))); /* check extensions */ +} #endif @@ -618,8 +619,10 @@ static int g_write (lua_State *L, FILE *f, int arg) { if (lua_type(L, arg) == LUA_TNUMBER) { /* optimization: could be done exactly as for strings */ int len = lua_isinteger(L, arg) - ? fprintf(f, LUA_INTEGER_FMT, lua_tointeger(L, arg)) - : fprintf(f, LUA_NUMBER_FMT, lua_tonumber(L, arg)); + ? fprintf(f, LUA_INTEGER_FMT, + (LUAI_UACINT)lua_tointeger(L, arg)) + : fprintf(f, LUA_NUMBER_FMT, + (LUAI_UACNUMBER)lua_tonumber(L, arg)); status = status && (len > 0); } else { |