From 86dd8bf3f58f118003d4b02773be08b68a5091ef Mon Sep 17 00:00:00 2001 From: Roberto Ierusalimschy Date: Mon, 27 Jan 2014 11:34:32 -0200 Subject: [PATCH] no more 'L' in macros "luai_num*" (several places that use those macros cannot throw errors anyway...) --- lapi.c | 4 ++-- lcode.c | 6 +++--- lobject.c | 16 ++++++++-------- ltable.c | 4 ++-- luaconf.h | 22 +++++++++++----------- lvm.c | 28 ++++++++++++++-------------- 6 files changed, 40 insertions(+), 40 deletions(-) diff --git a/lapi.c b/lapi.c index de13bd62..05640ef9 100644 --- a/lapi.c +++ b/lapi.c @@ -1,5 +1,5 @@ /* -** $Id: lapi.c,v 2.191 2013/12/04 12:15:22 roberto Exp roberto $ +** $Id: lapi.c,v 2.192 2013/12/30 20:47:58 roberto Exp roberto $ ** Lua API ** See Copyright Notice in lua.h */ @@ -389,7 +389,7 @@ LUA_API lua_Unsigned lua_tounsignedx (lua_State *L, int idx, int *pisnum) { n = -n; } n = l_mathop(fmod)(n, twop); - if (luai_numisnan(L,n)) /* not a number? */ + if (luai_numisnan(n)) /* not a number? */ break; /* not an integer, too */ res = cast_unsigned(n); if (neg) res = 0u - res; diff --git a/lcode.c b/lcode.c index 2da5e73a..f582b7dc 100644 --- a/lcode.c +++ b/lcode.c @@ -1,5 +1,5 @@ /* -** $Id: lcode.c,v 2.76 2013/12/18 18:44:42 roberto Exp roberto $ +** $Id: lcode.c,v 2.77 2013/12/30 20:47:58 roberto Exp roberto $ ** Code generator for Lua ** See Copyright Notice in lua.h */ @@ -364,7 +364,7 @@ int luaK_intK (FuncState *fs, lua_Integer n) { */ static int luaK_numberK (FuncState *fs, lua_Number r) { TValue o; - lua_assert(!luai_numisnan(NULL, r) && !isminuszero(r)); + lua_assert(!luai_numisnan(r) && !isminuszero(r)); setnvalue(&o, r); return addk(fs, &o, &o); } @@ -779,7 +779,7 @@ static int constfolding (OpCode op, expdesc *e1, expdesc *e2) { } else { lua_Number n = fltvalue(&res); - if (luai_numisnan(NULL, n) || isminuszero(n)) + if (luai_numisnan(n) || isminuszero(n)) return 0; /* folds neither NaN nor -0 */ e1->k = VKFLT; e1->u.nval = n; diff --git a/lobject.c b/lobject.c index 80f495a4..90a1e443 100644 --- a/lobject.c +++ b/lobject.c @@ -1,5 +1,5 @@ /* -** $Id: lobject.c,v 2.70 2013/12/18 14:12:03 roberto Exp roberto $ +** $Id: lobject.c,v 2.71 2013/12/30 20:47:58 roberto Exp roberto $ ** Some generic functions over Lua objects ** See Copyright Notice in lua.h */ @@ -93,13 +93,13 @@ static lua_Integer intarith (lua_State *L, int op, lua_Integer v1, static lua_Number numarith (int op, lua_Number v1, lua_Number v2) { switch (op) { - case LUA_OPADD: return luai_numadd(NULL, v1, v2); - case LUA_OPSUB: return luai_numsub(NULL, v1, v2); - case LUA_OPMUL: return luai_nummul(NULL, v1, v2); - case LUA_OPDIV: return luai_numdiv(NULL, v1, v2); - case LUA_OPMOD: return luai_nummod(NULL, v1, v2); - case LUA_OPPOW: return luai_numpow(NULL, v1, v2); - case LUA_OPUNM: return luai_numunm(NULL, v1); + case LUA_OPADD: return luai_numadd(v1, v2); + case LUA_OPSUB: return luai_numsub(v1, v2); + case LUA_OPMUL: return luai_nummul(v1, v2); + case LUA_OPDIV: return luai_numdiv(v1, v2); + case LUA_OPMOD: return luai_nummod(v1, v2); + case LUA_OPPOW: return luai_numpow(v1, v2); + case LUA_OPUNM: return luai_numunm(v1); default: lua_assert(0); return 0; } } diff --git a/ltable.c b/ltable.c index 493782db..36f6be0f 100644 --- a/ltable.c +++ b/ltable.c @@ -1,5 +1,5 @@ /* -** $Id: ltable.c,v 2.82 2013/08/29 13:49:57 roberto Exp roberto $ +** $Id: ltable.c,v 2.83 2013/09/11 12:26:14 roberto Exp roberto $ ** Lua tables (hash) ** See Copyright Notice in lua.h */ @@ -421,7 +421,7 @@ TValue *luaH_newkey (lua_State *L, Table *t, const TValue *key) { else if (ttisfloat(key)) { lua_Number n = fltvalue(key); lua_Integer k; - if (luai_numisnan(L, n)) + if (luai_numisnan(n)) luaG_runerror(L, "table index is NaN"); if (numisinteger(n, &k)) { /* index is int? */ setivalue(&aux, k); diff --git a/luaconf.h b/luaconf.h index c5c83278..39293e29 100644 --- a/luaconf.h +++ b/luaconf.h @@ -1,5 +1,5 @@ /* -** $Id: luaconf.h,v 1.187 2013/10/10 15:45:03 roberto Exp roberto $ +** $Id: luaconf.h,v 1.188 2013/11/21 17:23:14 roberto Exp roberto $ ** Configuration file for Lua ** See Copyright Notice in lua.h */ @@ -488,21 +488,21 @@ /* the following operations need the math library */ #if defined(lobject_c) || defined(lvm_c) #include -#define luai_nummod(L,a,b) ((a) - l_floor((a)/(b))*(b)) -#define luai_numpow(L,a,b) (l_mathop(pow)(a,b)) +#define luai_nummod(a,b) ((a) - l_floor((a)/(b))*(b)) +#define luai_numpow(a,b) (l_mathop(pow)(a,b)) #endif /* these are quite standard operations */ #if defined(LUA_CORE) -#define luai_numadd(L,a,b) ((a)+(b)) -#define luai_numsub(L,a,b) ((a)-(b)) -#define luai_nummul(L,a,b) ((a)*(b)) -#define luai_numdiv(L,a,b) ((a)/(b)) -#define luai_numunm(L,a) (-(a)) +#define luai_numadd(a,b) ((a)+(b)) +#define luai_numsub(a,b) ((a)-(b)) +#define luai_nummul(a,b) ((a)*(b)) +#define luai_numdiv(a,b) ((a)/(b)) +#define luai_numunm(a) (-(a)) #define luai_numeq(a,b) ((a)==(b)) -#define luai_numlt(L,a,b) ((a)<(b)) -#define luai_numle(L,a,b) ((a)<=(b)) -#define luai_numisnan(L,a) (!luai_numeq((a), (a))) +#define luai_numlt(a,b) ((a)<(b)) +#define luai_numle(a,b) ((a)<=(b)) +#define luai_numisnan(a) (!luai_numeq((a), (a))) #endif diff --git a/lvm.c b/lvm.c index a84a45dc..998cea9f 100644 --- a/lvm.c +++ b/lvm.c @@ -1,5 +1,5 @@ /* -** $Id: lvm.c,v 2.183 2013/12/30 20:47:58 roberto Exp roberto $ +** $Id: lvm.c,v 2.184 2014/01/22 20:02:04 roberto Exp roberto $ ** Lua virtual machine ** See Copyright Notice in lua.h */ @@ -193,7 +193,7 @@ int luaV_lessthan (lua_State *L, const TValue *l, const TValue *r) { if (ttisinteger(l) && ttisinteger(r)) return (ivalue(l) < ivalue(r)); else if (tonumber(l, &nl) && tonumber(r, &nr)) - return luai_numlt(L, nl, nr); + return luai_numlt(nl, nr); else if (ttisstring(l) && ttisstring(r)) return l_strcmp(rawtsvalue(l), rawtsvalue(r)) < 0; else if ((res = luaT_callorderTM(L, l, r, TM_LT)) < 0) @@ -208,7 +208,7 @@ int luaV_lessequal (lua_State *L, const TValue *l, const TValue *r) { if (ttisinteger(l) && ttisinteger(r)) return (ivalue(l) <= ivalue(r)); else if (tonumber(l, &nl) && tonumber(r, &nr)) - return luai_numle(L, nl, nr); + return luai_numle(nl, nr); else if (ttisstring(l) && ttisstring(r)) return l_strcmp(rawtsvalue(l), rawtsvalue(r)) <= 0; else if ((res = luaT_callorderTM(L, l, r, TM_LE)) >= 0) /* first try `le' */ @@ -641,7 +641,7 @@ void luaV_execute (lua_State *L) { setivalue(ra, intop(+, ib, ic)); } else if (tonumber(rb, &nb) && tonumber(rc, &nc)) { - setnvalue(ra, luai_numadd(L, nb, nc)); + setnvalue(ra, luai_numadd(nb, nc)); } else { Protect(luaT_trybinTM(L, rb, rc, ra, TM_ADD)); } ) @@ -654,7 +654,7 @@ void luaV_execute (lua_State *L) { setivalue(ra, intop(-, ib, ic)); } else if (tonumber(rb, &nb) && tonumber(rc, &nc)) { - setnvalue(ra, luai_numsub(L, nb, nc)); + setnvalue(ra, luai_numsub(nb, nc)); } else { Protect(luaT_trybinTM(L, rb, rc, ra, TM_SUB)); } ) @@ -667,7 +667,7 @@ void luaV_execute (lua_State *L) { setivalue(ra, intop(*, ib, ic)); } else if (tonumber(rb, &nb) && tonumber(rc, &nc)) { - setnvalue(ra, luai_nummul(L, nb, nc)); + setnvalue(ra, luai_nummul(nb, nc)); } else { Protect(luaT_trybinTM(L, rb, rc, ra, TM_MUL)); } ) @@ -676,7 +676,7 @@ void luaV_execute (lua_State *L) { TValue *rc = RKC(i); lua_Number nb; lua_Number nc; if (tonumber(rb, &nb) && tonumber(rc, &nc)) { - setnvalue(ra, luai_numdiv(L, nb, nc)); + setnvalue(ra, luai_numdiv(nb, nc)); } else { Protect(luaT_trybinTM(L, rb, rc, ra, TM_DIV)); } ) @@ -743,7 +743,7 @@ void luaV_execute (lua_State *L) { setivalue(ra, luaV_mod(L, ib, ic)); } else if (tonumber(rb, &nb) && tonumber(rc, &nc)) { - setnvalue(ra, luai_nummod(L, nb, nc)); + setnvalue(ra, luai_nummod(nb, nc)); } else { Protect(luaT_trybinTM(L, rb, rc, ra, TM_MOD)); } ) @@ -756,7 +756,7 @@ void luaV_execute (lua_State *L) { setivalue(ra, luaV_pow(L, ib, ic)); } else if (tonumber(rb, &nb) && tonumber(rc, &nc)) { - setnvalue(ra, luai_numpow(L, nb, nc)); + setnvalue(ra, luai_numpow(nb, nc)); } else { Protect(luaT_trybinTM(L, rb, rc, ra, TM_POW)); } ) @@ -768,7 +768,7 @@ void luaV_execute (lua_State *L) { setivalue(ra, intop(-, 0, ib)); } else if (tonumber(rb, &nb)) { - setnvalue(ra, luai_numunm(L, nb)); + setnvalue(ra, luai_numunm(nb)); } else { Protect(luaT_trybinTM(L, rb, rb, ra, TM_UNM)); @@ -919,10 +919,10 @@ void luaV_execute (lua_State *L) { } else { /* floating count */ lua_Number step = fltvalue(ra + 2); - lua_Number idx = luai_numadd(L, fltvalue(ra), step); /* inc. index */ + lua_Number idx = luai_numadd(fltvalue(ra), step); /* inc. index */ lua_Number limit = fltvalue(ra + 1); - if (luai_numlt(L, 0, step) ? luai_numle(L, idx, limit) - : luai_numle(L, limit, idx)) { + if (luai_numlt(0, step) ? luai_numle(idx, limit) + : luai_numle(limit, idx)) { ci->u.l.savedpc += GETARG_sBx(i); /* jump back */ setnvalue(ra, idx); /* update internal index... */ setnvalue(ra + 3, idx); /* ...and external index */ @@ -946,7 +946,7 @@ void luaV_execute (lua_State *L) { setnvalue(pstep, nstep); if (!tonumber(init, &ninit)) luaG_runerror(L, LUA_QL("for") " initial value must be a number"); - setnvalue(ra, luai_numsub(L, ninit, nstep)); + setnvalue(ra, luai_numsub(ninit, nstep)); } ci->u.l.savedpc += GETARG_sBx(i); )