summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRoberto Ierusalimschy <roberto@inf.puc-rio.br>2014-07-15 18:26:50 -0300
committerRoberto Ierusalimschy <roberto@inf.puc-rio.br>2014-07-15 18:26:50 -0300
commit5bbb4a06a692ec2c9773274f0f99c7573838e86b (patch)
tree4bfac6a4dde1a3f0764b7bdbdcb697a0581b9452
parentd4fb848be77f4b0209acaf37a5b5e1cee741ddce (diff)
downloadlua-5bbb4a06a692ec2c9773274f0f99c7573838e86b.tar.gz
lua-5bbb4a06a692ec2c9773274f0f99c7573838e86b.tar.bz2
lua-5bbb4a06a692ec2c9773274f0f99c7573838e86b.zip
removed unused parameter Ä'L' in macro 'api_check' and company
-rw-r--r--lapi.c78
-rw-r--r--lapi.h6
-rw-r--r--ldebug.c4
-rw-r--r--ldo.c4
-rw-r--r--llimits.h11
-rw-r--r--lmem.c4
6 files changed, 52 insertions, 55 deletions
diff --git a/lapi.c b/lapi.c
index 988f3d3a..eeba6867 100644
--- a/lapi.c
+++ b/lapi.c
@@ -1,5 +1,5 @@
1/* 1/*
2** $Id: lapi.c,v 2.223 2014/06/30 19:48:08 roberto Exp roberto $ 2** $Id: lapi.c,v 2.224 2014/07/15 21:14:49 roberto Exp roberto $
3** Lua API 3** Lua API
4** See Copyright Notice in lua.h 4** See Copyright Notice in lua.h
5*/ 5*/
@@ -47,29 +47,29 @@ const char lua_ident[] =
47/* test for valid but not pseudo index */ 47/* test for valid but not pseudo index */
48#define isstackindex(i, o) (isvalid(o) && !ispseudo(i)) 48#define isstackindex(i, o) (isvalid(o) && !ispseudo(i))
49 49
50#define api_checkvalidindex(L, o) api_check(L, isvalid(o), "invalid index") 50#define api_checkvalidindex(o) api_check(isvalid(o), "invalid index")
51 51
52#define api_checkstackindex(L, i, o) \ 52#define api_checkstackindex(i, o) \
53 api_check(L, isstackindex(i, o), "index not in the stack") 53 api_check(isstackindex(i, o), "index not in the stack")
54 54
55 55
56static TValue *index2addr (lua_State *L, int idx) { 56static TValue *index2addr (lua_State *L, int idx) {
57 CallInfo *ci = L->ci; 57 CallInfo *ci = L->ci;
58 if (idx > 0) { 58 if (idx > 0) {
59 TValue *o = ci->func + idx; 59 TValue *o = ci->func + idx;
60 api_check(L, idx <= ci->top - (ci->func + 1), "unacceptable index"); 60 api_check(idx <= ci->top - (ci->func + 1), "unacceptable index");
61 if (o >= L->top) return NONVALIDVALUE; 61 if (o >= L->top) return NONVALIDVALUE;
62 else return o; 62 else return o;
63 } 63 }
64 else if (!ispseudo(idx)) { /* negative index */ 64 else if (!ispseudo(idx)) { /* negative index */
65 api_check(L, idx != 0 && -idx <= L->top - (ci->func + 1), "invalid index"); 65 api_check(idx != 0 && -idx <= L->top - (ci->func + 1), "invalid index");
66 return L->top + idx; 66 return L->top + idx;
67 } 67 }
68 else if (idx == LUA_REGISTRYINDEX) 68 else if (idx == LUA_REGISTRYINDEX)
69 return &G(L)->l_registry; 69 return &G(L)->l_registry;
70 else { /* upvalues */ 70 else { /* upvalues */
71 idx = LUA_REGISTRYINDEX - idx; 71 idx = LUA_REGISTRYINDEX - idx;
72 api_check(L, idx <= MAXUPVAL + 1, "upvalue index too large"); 72 api_check(idx <= MAXUPVAL + 1, "upvalue index too large");
73 if (ttislcf(ci->func)) /* light C function? */ 73 if (ttislcf(ci->func)) /* light C function? */
74 return NONVALIDVALUE; /* it has no upvalues */ 74 return NONVALIDVALUE; /* it has no upvalues */
75 else { 75 else {
@@ -94,7 +94,7 @@ LUA_API int lua_checkstack (lua_State *L, int size) {
94 int res; 94 int res;
95 CallInfo *ci = L->ci; 95 CallInfo *ci = L->ci;
96 lua_lock(L); 96 lua_lock(L);
97 api_check(L, size >= 0, "negative 'size'"); 97 api_check(size >= 0, "negative 'size'");
98 if (L->stack_last - L->top > size) /* stack large enough? */ 98 if (L->stack_last - L->top > size) /* stack large enough? */
99 res = 1; /* yes; check is OK */ 99 res = 1; /* yes; check is OK */
100 else { /* no; need to grow stack */ 100 else { /* no; need to grow stack */
@@ -116,8 +116,8 @@ LUA_API void lua_xmove (lua_State *from, lua_State *to, int n) {
116 if (from == to) return; 116 if (from == to) return;
117 lua_lock(to); 117 lua_lock(to);
118 api_checknelems(from, n); 118 api_checknelems(from, n);
119 api_check(from, G(from) == G(to), "moving among independent states"); 119 api_check(G(from) == G(to), "moving among independent states");
120 api_check(from, to->ci->top - to->top >= n, "not enough elements to move"); 120 api_check(to->ci->top - to->top >= n, "not enough elements to move");
121 from->top -= n; 121 from->top -= n;
122 for (i = 0; i < n; i++) { 122 for (i = 0; i < n; i++) {
123 setobj2s(to, to->top++, from->top + i); 123 setobj2s(to, to->top++, from->top + i);
@@ -168,13 +168,13 @@ LUA_API void lua_settop (lua_State *L, int idx) {
168 StkId func = L->ci->func; 168 StkId func = L->ci->func;
169 lua_lock(L); 169 lua_lock(L);
170 if (idx >= 0) { 170 if (idx >= 0) {
171 api_check(L, idx <= L->stack_last - (func + 1), "new top too large"); 171 api_check(idx <= L->stack_last - (func + 1), "new top too large");
172 while (L->top < (func + 1) + idx) 172 while (L->top < (func + 1) + idx)
173 setnilvalue(L->top++); 173 setnilvalue(L->top++);
174 L->top = (func + 1) + idx; 174 L->top = (func + 1) + idx;
175 } 175 }
176 else { 176 else {
177 api_check(L, -(idx+1) <= (L->top - (func + 1)), "invalid new top"); 177 api_check(-(idx+1) <= (L->top - (func + 1)), "invalid new top");
178 L->top += idx+1; /* `subtract' index (index is negative) */ 178 L->top += idx+1; /* `subtract' index (index is negative) */
179 } 179 }
180 lua_unlock(L); 180 lua_unlock(L);
@@ -204,8 +204,8 @@ LUA_API void lua_rotate (lua_State *L, int idx, int n) {
204 lua_lock(L); 204 lua_lock(L);
205 t = L->top - 1; /* end of stack segment being rotated */ 205 t = L->top - 1; /* end of stack segment being rotated */
206 p = index2addr(L, idx); /* start of segment */ 206 p = index2addr(L, idx); /* start of segment */
207 api_checkstackindex(L, idx, p); 207 api_checkstackindex(idx, p);
208 api_check(L, (n >= 0 ? n : -n) <= (t - p + 1), "invalid 'n'"); 208 api_check((n >= 0 ? n : -n) <= (t - p + 1), "invalid 'n'");
209 m = (n >= 0 ? t - n : p - n - 1); /* end of prefix */ 209 m = (n >= 0 ? t - n : p - n - 1); /* end of prefix */
210 reverse(L, p, m); /* reverse the prefix with length 'n' */ 210 reverse(L, p, m); /* reverse the prefix with length 'n' */
211 reverse(L, m + 1, t); /* reverse the suffix */ 211 reverse(L, m + 1, t); /* reverse the suffix */
@@ -216,7 +216,7 @@ LUA_API void lua_rotate (lua_State *L, int idx, int n) {
216 216
217static void moveto (lua_State *L, TValue *fr, int idx) { 217static void moveto (lua_State *L, TValue *fr, int idx) {
218 TValue *to = index2addr(L, idx); 218 TValue *to = index2addr(L, idx);
219 api_checkvalidindex(L, to); 219 api_checkvalidindex(to);
220 setobj(L, to, fr); 220 setobj(L, to, fr);
221 if (idx < LUA_REGISTRYINDEX) /* function upvalue? */ 221 if (idx < LUA_REGISTRYINDEX) /* function upvalue? */
222 luaC_barrier(L, clCvalue(L->ci->func), fr); 222 luaC_barrier(L, clCvalue(L->ci->func), fr);
@@ -264,8 +264,8 @@ LUA_API int lua_type (lua_State *L, int idx) {
264 264
265 265
266LUA_API const char *lua_typename (lua_State *L, int t) { 266LUA_API const char *lua_typename (lua_State *L, int t) {
267 (void)L; 267 UNUSED(L);
268 api_check(L, LUA_TNONE <= t && t < LUA_NUMTAGS, "invalid tag"); 268 api_check(LUA_TNONE <= t && t < LUA_NUMTAGS, "invalid tag");
269 return ttypename(t); 269 return ttypename(t);
270} 270}
271 271
@@ -335,7 +335,7 @@ LUA_API int lua_compare (lua_State *L, int index1, int index2, int op) {
335 case LUA_OPEQ: i = luaV_equalobj(L, o1, o2); break; 335 case LUA_OPEQ: i = luaV_equalobj(L, o1, o2); break;
336 case LUA_OPLT: i = luaV_lessthan(L, o1, o2); break; 336 case LUA_OPLT: i = luaV_lessthan(L, o1, o2); break;
337 case LUA_OPLE: i = luaV_lessequal(L, o1, o2); break; 337 case LUA_OPLE: i = luaV_lessequal(L, o1, o2); break;
338 default: api_check(L, 0, "invalid option"); 338 default: api_check(0, "invalid option");
339 } 339 }
340 } 340 }
341 lua_unlock(L); 341 lua_unlock(L);
@@ -541,7 +541,7 @@ LUA_API void lua_pushcclosure (lua_State *L, lua_CFunction fn, int n) {
541 else { 541 else {
542 CClosure *cl; 542 CClosure *cl;
543 api_checknelems(L, n); 543 api_checknelems(L, n);
544 api_check(L, n <= MAXUPVAL, "upvalue index too large"); 544 api_check(n <= MAXUPVAL, "upvalue index too large");
545 luaC_checkGC(L); 545 luaC_checkGC(L);
546 cl = luaF_newCclosure(L, n); 546 cl = luaF_newCclosure(L, n);
547 cl->f = fn; 547 cl->f = fn;
@@ -626,7 +626,7 @@ LUA_API int lua_rawget (lua_State *L, int idx) {
626 StkId t; 626 StkId t;
627 lua_lock(L); 627 lua_lock(L);
628 t = index2addr(L, idx); 628 t = index2addr(L, idx);
629 api_check(L, ttistable(t), "table expected"); 629 api_check(ttistable(t), "table expected");
630 setobj2s(L, L->top - 1, luaH_get(hvalue(t), L->top - 1)); 630 setobj2s(L, L->top - 1, luaH_get(hvalue(t), L->top - 1));
631 lua_unlock(L); 631 lua_unlock(L);
632 return ttnov(L->top - 1); 632 return ttnov(L->top - 1);
@@ -637,7 +637,7 @@ LUA_API int lua_rawgeti (lua_State *L, int idx, lua_Integer n) {
637 StkId t; 637 StkId t;
638 lua_lock(L); 638 lua_lock(L);
639 t = index2addr(L, idx); 639 t = index2addr(L, idx);
640 api_check(L, ttistable(t), "table expected"); 640 api_check(ttistable(t), "table expected");
641 setobj2s(L, L->top, luaH_getint(hvalue(t), n)); 641 setobj2s(L, L->top, luaH_getint(hvalue(t), n));
642 api_incr_top(L); 642 api_incr_top(L);
643 lua_unlock(L); 643 lua_unlock(L);
@@ -650,7 +650,7 @@ LUA_API int lua_rawgetp (lua_State *L, int idx, const void *p) {
650 TValue k; 650 TValue k;
651 lua_lock(L); 651 lua_lock(L);
652 t = index2addr(L, idx); 652 t = index2addr(L, idx);
653 api_check(L, ttistable(t), "table expected"); 653 api_check(ttistable(t), "table expected");
654 setpvalue(&k, cast(void *, p)); 654 setpvalue(&k, cast(void *, p));
655 setobj2s(L, L->top, luaH_get(hvalue(t), &k)); 655 setobj2s(L, L->top, luaH_get(hvalue(t), &k));
656 api_incr_top(L); 656 api_incr_top(L);
@@ -705,7 +705,7 @@ LUA_API int lua_getuservalue (lua_State *L, int idx) {
705 StkId o; 705 StkId o;
706 lua_lock(L); 706 lua_lock(L);
707 o = index2addr(L, idx); 707 o = index2addr(L, idx);
708 api_check(L, ttisfulluserdata(o), "full userdata expected"); 708 api_check(ttisfulluserdata(o), "full userdata expected");
709 getuservalue(L, rawuvalue(o), L->top); 709 getuservalue(L, rawuvalue(o), L->top);
710 api_incr_top(L); 710 api_incr_top(L);
711 lua_unlock(L); 711 lua_unlock(L);
@@ -759,7 +759,7 @@ LUA_API void lua_rawset (lua_State *L, int idx) {
759 lua_lock(L); 759 lua_lock(L);
760 api_checknelems(L, 2); 760 api_checknelems(L, 2);
761 t = index2addr(L, idx); 761 t = index2addr(L, idx);
762 api_check(L, ttistable(t), "table expected"); 762 api_check(ttistable(t), "table expected");
763 setobj2t(L, luaH_set(L, hvalue(t), L->top-2), L->top-1); 763 setobj2t(L, luaH_set(L, hvalue(t), L->top-2), L->top-1);
764 invalidateTMcache(hvalue(t)); 764 invalidateTMcache(hvalue(t));
765 luaC_barrierback(L, gcvalue(t), L->top-1); 765 luaC_barrierback(L, gcvalue(t), L->top-1);
@@ -773,7 +773,7 @@ LUA_API void lua_rawseti (lua_State *L, int idx, lua_Integer n) {
773 lua_lock(L); 773 lua_lock(L);
774 api_checknelems(L, 1); 774 api_checknelems(L, 1);
775 t = index2addr(L, idx); 775 t = index2addr(L, idx);
776 api_check(L, ttistable(t), "table expected"); 776 api_check(ttistable(t), "table expected");
777 luaH_setint(L, hvalue(t), n, L->top - 1); 777 luaH_setint(L, hvalue(t), n, L->top - 1);
778 luaC_barrierback(L, gcvalue(t), L->top-1); 778 luaC_barrierback(L, gcvalue(t), L->top-1);
779 L->top--; 779 L->top--;
@@ -787,7 +787,7 @@ LUA_API void lua_rawsetp (lua_State *L, int idx, const void *p) {
787 lua_lock(L); 787 lua_lock(L);
788 api_checknelems(L, 1); 788 api_checknelems(L, 1);
789 t = index2addr(L, idx); 789 t = index2addr(L, idx);
790 api_check(L, ttistable(t), "table expected"); 790 api_check(ttistable(t), "table expected");
791 setpvalue(&k, cast(void *, p)); 791 setpvalue(&k, cast(void *, p));
792 setobj2t(L, luaH_set(L, hvalue(t), &k), L->top - 1); 792 setobj2t(L, luaH_set(L, hvalue(t), &k), L->top - 1);
793 luaC_barrierback(L, gcvalue(t), L->top - 1); 793 luaC_barrierback(L, gcvalue(t), L->top - 1);
@@ -805,7 +805,7 @@ LUA_API int lua_setmetatable (lua_State *L, int objindex) {
805 if (ttisnil(L->top - 1)) 805 if (ttisnil(L->top - 1))
806 mt = NULL; 806 mt = NULL;
807 else { 807 else {
808 api_check(L, ttistable(L->top - 1), "table expected"); 808 api_check(ttistable(L->top - 1), "table expected");
809 mt = hvalue(L->top - 1); 809 mt = hvalue(L->top - 1);
810 } 810 }
811 switch (ttnov(obj)) { 811 switch (ttnov(obj)) {
@@ -841,7 +841,7 @@ LUA_API void lua_setuservalue (lua_State *L, int idx) {
841 lua_lock(L); 841 lua_lock(L);
842 api_checknelems(L, 1); 842 api_checknelems(L, 1);
843 o = index2addr(L, idx); 843 o = index2addr(L, idx);
844 api_check(L, ttisfulluserdata(o), "full userdata expected"); 844 api_check(ttisfulluserdata(o), "full userdata expected");
845 setuservalue(L, rawuvalue(o), L->top - 1); 845 setuservalue(L, rawuvalue(o), L->top - 1);
846 luaC_barrier(L, gcvalue(o), L->top - 1); 846 luaC_barrier(L, gcvalue(o), L->top - 1);
847 L->top--; 847 L->top--;
@@ -855,7 +855,7 @@ LUA_API void lua_setuservalue (lua_State *L, int idx) {
855 855
856 856
857#define checkresults(L,na,nr) \ 857#define checkresults(L,na,nr) \
858 api_check(L, (nr) == LUA_MULTRET || (L->ci->top - L->top >= (nr) - (na)), \ 858 api_check((nr) == LUA_MULTRET || (L->ci->top - L->top >= (nr) - (na)), \
859 "results from function overflow current stack size") 859 "results from function overflow current stack size")
860 860
861 861
@@ -863,10 +863,10 @@ LUA_API void lua_callk (lua_State *L, int nargs, int nresults, int ctx,
863 lua_KFunction k) { 863 lua_KFunction k) {
864 StkId func; 864 StkId func;
865 lua_lock(L); 865 lua_lock(L);
866 api_check(L, k == NULL || !isLua(L->ci), 866 api_check(k == NULL || !isLua(L->ci),
867 "cannot use continuations inside hooks"); 867 "cannot use continuations inside hooks");
868 api_checknelems(L, nargs+1); 868 api_checknelems(L, nargs+1);
869 api_check(L, L->status == LUA_OK, "cannot do calls on non-normal thread"); 869 api_check(L->status == LUA_OK, "cannot do calls on non-normal thread");
870 checkresults(L, nargs, nresults); 870 checkresults(L, nargs, nresults);
871 func = L->top - (nargs+1); 871 func = L->top - (nargs+1);
872 if (k != NULL && L->nny == 0) { /* need to prepare continuation? */ 872 if (k != NULL && L->nny == 0) { /* need to prepare continuation? */
@@ -904,16 +904,16 @@ LUA_API int lua_pcallk (lua_State *L, int nargs, int nresults, int errfunc,
904 int status; 904 int status;
905 ptrdiff_t func; 905 ptrdiff_t func;
906 lua_lock(L); 906 lua_lock(L);
907 api_check(L, k == NULL || !isLua(L->ci), 907 api_check(k == NULL || !isLua(L->ci),
908 "cannot use continuations inside hooks"); 908 "cannot use continuations inside hooks");
909 api_checknelems(L, nargs+1); 909 api_checknelems(L, nargs+1);
910 api_check(L, L->status == LUA_OK, "cannot do calls on non-normal thread"); 910 api_check(L->status == LUA_OK, "cannot do calls on non-normal thread");
911 checkresults(L, nargs, nresults); 911 checkresults(L, nargs, nresults);
912 if (errfunc == 0) 912 if (errfunc == 0)
913 func = 0; 913 func = 0;
914 else { 914 else {
915 StkId o = index2addr(L, errfunc); 915 StkId o = index2addr(L, errfunc);
916 api_checkstackindex(L, errfunc, o); 916 api_checkstackindex(errfunc, o);
917 func = savestack(L, o); 917 func = savestack(L, o);
918 } 918 }
919 c.func = L->top - (nargs+1); /* function to be called */ 919 c.func = L->top - (nargs+1); /* function to be called */
@@ -1078,7 +1078,7 @@ LUA_API int lua_next (lua_State *L, int idx) {
1078 int more; 1078 int more;
1079 lua_lock(L); 1079 lua_lock(L);
1080 t = index2addr(L, idx); 1080 t = index2addr(L, idx);
1081 api_check(L, ttistable(t), "table expected"); 1081 api_check(ttistable(t), "table expected");
1082 more = luaH_next(L, hvalue(t), L->top - 1); 1082 more = luaH_next(L, hvalue(t), L->top - 1);
1083 if (more) { 1083 if (more) {
1084 api_incr_top(L); 1084 api_incr_top(L);
@@ -1210,9 +1210,9 @@ LUA_API const char *lua_setupvalue (lua_State *L, int funcindex, int n) {
1210static UpVal **getupvalref (lua_State *L, int fidx, int n, LClosure **pf) { 1210static UpVal **getupvalref (lua_State *L, int fidx, int n, LClosure **pf) {
1211 LClosure *f; 1211 LClosure *f;
1212 StkId fi = index2addr(L, fidx); 1212 StkId fi = index2addr(L, fidx);
1213 api_check(L, ttisLclosure(fi), "Lua function expected"); 1213 api_check(ttisLclosure(fi), "Lua function expected");
1214 f = clLvalue(fi); 1214 f = clLvalue(fi);
1215 api_check(L, (1 <= n && n <= f->p->sizeupvalues), "invalid upvalue index"); 1215 api_check((1 <= n && n <= f->p->sizeupvalues), "invalid upvalue index");
1216 if (pf) *pf = f; 1216 if (pf) *pf = f;
1217 return &f->upvals[n - 1]; /* get its upvalue pointer */ 1217 return &f->upvals[n - 1]; /* get its upvalue pointer */
1218} 1218}
@@ -1226,11 +1226,11 @@ LUA_API void *lua_upvalueid (lua_State *L, int fidx, int n) {
1226 } 1226 }
1227 case LUA_TCCL: { /* C closure */ 1227 case LUA_TCCL: { /* C closure */
1228 CClosure *f = clCvalue(fi); 1228 CClosure *f = clCvalue(fi);
1229 api_check(L, 1 <= n && n <= f->nupvalues, "invalid upvalue index"); 1229 api_check(1 <= n && n <= f->nupvalues, "invalid upvalue index");
1230 return &f->upvalue[n - 1]; 1230 return &f->upvalue[n - 1];
1231 } 1231 }
1232 default: { 1232 default: {
1233 api_check(L, 0, "closure expected"); 1233 api_check(0, "closure expected");
1234 return NULL; 1234 return NULL;
1235 } 1235 }
1236 } 1236 }
diff --git a/lapi.h b/lapi.h
index 569953f4..3f10e6fb 100644
--- a/lapi.h
+++ b/lapi.h
@@ -1,5 +1,5 @@
1/* 1/*
2** $Id: lapi.h,v 2.6 2009/08/31 14:26:28 roberto Exp roberto $ 2** $Id: lapi.h,v 2.7 2009/11/27 15:37:59 roberto Exp roberto $
3** Auxiliary functions from Lua API 3** Auxiliary functions from Lua API
4** See Copyright Notice in lua.h 4** See Copyright Notice in lua.h
5*/ 5*/
@@ -11,13 +11,13 @@
11#include "llimits.h" 11#include "llimits.h"
12#include "lstate.h" 12#include "lstate.h"
13 13
14#define api_incr_top(L) {L->top++; api_check(L, L->top <= L->ci->top, \ 14#define api_incr_top(L) {L->top++; api_check(L->top <= L->ci->top, \
15 "stack overflow");} 15 "stack overflow");}
16 16
17#define adjustresults(L,nres) \ 17#define adjustresults(L,nres) \
18 { if ((nres) == LUA_MULTRET && L->ci->top < L->top) L->ci->top = L->top; } 18 { if ((nres) == LUA_MULTRET && L->ci->top < L->top) L->ci->top = L->top; }
19 19
20#define api_checknelems(L,n) api_check(L, (n) < (L->top - L->ci->func), \ 20#define api_checknelems(L,n) api_check((n) < (L->top - L->ci->func), \
21 "not enough elements in the stack") 21 "not enough elements in the stack")
22 22
23 23
diff --git a/ldebug.c b/ldebug.c
index dda88a20..2c3c70f3 100644
--- a/ldebug.c
+++ b/ldebug.c
@@ -1,5 +1,5 @@
1/* 1/*
2** $Id: ldebug.c,v 2.96 2013/07/10 20:32:36 roberto Exp roberto $ 2** $Id: ldebug.c,v 2.97 2013/12/09 14:21:10 roberto Exp roberto $
3** Debug Interface 3** Debug Interface
4** See Copyright Notice in lua.h 4** See Copyright Notice in lua.h
5*/ 5*/
@@ -271,7 +271,7 @@ LUA_API int lua_getinfo (lua_State *L, const char *what, lua_Debug *ar) {
271 if (*what == '>') { 271 if (*what == '>') {
272 ci = NULL; 272 ci = NULL;
273 func = L->top - 1; 273 func = L->top - 1;
274 api_check(L, ttisfunction(func), "function expected"); 274 api_check(ttisfunction(func), "function expected");
275 what++; /* skip the '>' */ 275 what++; /* skip the '>' */
276 L->top--; /* pop function */ 276 L->top--; /* pop function */
277 } 277 }
diff --git a/ldo.c b/ldo.c
index 4d859048..1a49ceda 100644
--- a/ldo.c
+++ b/ldo.c
@@ -1,5 +1,5 @@
1/* 1/*
2** $Id: ldo.c,v 2.123 2014/06/19 18:27:20 roberto Exp roberto $ 2** $Id: ldo.c,v 2.124 2014/06/30 19:48:08 roberto Exp roberto $
3** Stack and Call structure of Lua 3** Stack and Call structure of Lua
4** See Copyright Notice in lua.h 4** See Copyright Notice in lua.h
5*/ 5*/
@@ -607,7 +607,7 @@ LUA_API int lua_yieldk (lua_State *L, int nresults, int ctx, lua_KFunction k) {
607 L->status = LUA_YIELD; 607 L->status = LUA_YIELD;
608 ci->extra = savestack(L, ci->func); /* save current 'func' */ 608 ci->extra = savestack(L, ci->func); /* save current 'func' */
609 if (isLua(ci)) { /* inside a hook? */ 609 if (isLua(ci)) { /* inside a hook? */
610 api_check(L, k == NULL, "hooks cannot continue after yielding"); 610 api_check(k == NULL, "hooks cannot continue after yielding");
611 } 611 }
612 else { 612 else {
613 if ((ci->u.c.k = k) != NULL) /* is there a continuation? */ 613 if ((ci->u.c.k = k) != NULL) /* is there a continuation? */
diff --git a/llimits.h b/llimits.h
index a128ae4b..f9fb8d00 100644
--- a/llimits.h
+++ b/llimits.h
@@ -1,5 +1,5 @@
1/* 1/*
2** $Id: llimits.h,v 1.116 2014/04/15 16:32:49 roberto Exp roberto $ 2** $Id: llimits.h,v 1.117 2014/06/26 16:17:35 roberto Exp roberto $
3** Limits, basic types, and some other `installation-dependent' definitions 3** Limits, basic types, and some other `installation-dependent' definitions
4** See Copyright Notice in lua.h 4** See Copyright Notice in lua.h
5*/ 5*/
@@ -79,18 +79,15 @@ typedef LUAI_UACINT l_uacInt;
79/* 79/*
80** assertion for checking API calls 80** assertion for checking API calls
81*/ 81*/
82#if !defined(luai_apicheck)
83
84#if defined(LUA_USE_APICHECK) 82#if defined(LUA_USE_APICHECK)
85#include <assert.h> 83#include <assert.h>
86#define luai_apicheck(L,e) assert(e) 84#define luai_apicheck(e) assert(e)
87#else 85#else
88#define luai_apicheck(L,e) lua_assert(e) 86#define luai_apicheck(e) lua_assert(e)
89#endif 87#endif
90 88
91#endif
92 89
93#define api_check(l,e,msg) luai_apicheck(l,(e) && msg) 90#define api_check(e,msg) luai_apicheck((e) && msg)
94 91
95 92
96#if !defined(UNUSED) 93#if !defined(UNUSED)
diff --git a/lmem.c b/lmem.c
index 267e269f..a58951e2 100644
--- a/lmem.c
+++ b/lmem.c
@@ -1,5 +1,5 @@
1/* 1/*
2** $Id: lmem.c,v 1.84 2012/05/23 15:41:53 roberto Exp roberto $ 2** $Id: lmem.c,v 1.85 2014/06/26 18:29:05 roberto Exp roberto $
3** Interface to Memory Manager 3** Interface to Memory Manager
4** See Copyright Notice in lua.h 4** See Copyright Notice in lua.h
5*/ 5*/
@@ -83,7 +83,7 @@ void *luaM_realloc_ (lua_State *L, void *block, size_t osize, size_t nsize) {
83#endif 83#endif
84 newblock = (*g->frealloc)(g->ud, block, osize, nsize); 84 newblock = (*g->frealloc)(g->ud, block, osize, nsize);
85 if (newblock == NULL && nsize > 0) { 85 if (newblock == NULL && nsize > 0) {
86 api_check(L, nsize > realosize, 86 api_check( nsize > realosize,
87 "realloc cannot fail when shrinking a block"); 87 "realloc cannot fail when shrinking a block");
88 luaC_fullgc(L, 1); /* try to free some memory... */ 88 luaC_fullgc(L, 1); /* try to free some memory... */
89 newblock = (*g->frealloc)(g->ud, block, osize, nsize); /* try again */ 89 newblock = (*g->frealloc)(g->ud, block, osize, nsize); /* try again */