aboutsummaryrefslogtreecommitdiff
path: root/lapi.c
diff options
context:
space:
mode:
authorRoberto Ierusalimschy <roberto@inf.puc-rio.br>2015-11-02 16:48:07 -0200
committerRoberto Ierusalimschy <roberto@inf.puc-rio.br>2015-11-02 16:48:07 -0200
commitff1289a361eb2b077d0df83eaed21647444541ef (patch)
treecbbe9372b6a317c06ff1724b36734bdc45df5441 /lapi.c
parentcd73f3ccc5e85bc2b3e45477e2f6e3b705bf3c24 (diff)
downloadlua-ff1289a361eb2b077d0df83eaed21647444541ef.tar.gz
lua-ff1289a361eb2b077d0df83eaed21647444541ef.tar.bz2
lua-ff1289a361eb2b077d0df83eaed21647444541ef.zip
in 'luaD_call', use two functions instead of one with fixed boolean
argument
Diffstat (limited to 'lapi.c')
-rw-r--r--lapi.c14
1 files changed, 7 insertions, 7 deletions
diff --git a/lapi.c b/lapi.c
index 072190bc..9daf0545 100644
--- a/lapi.c
+++ b/lapi.c
@@ -1,5 +1,5 @@
1/* 1/*
2** $Id: lapi.c,v 2.255 2015/09/09 13:45:50 roberto Exp roberto $ 2** $Id: lapi.c,v 2.256 2015/10/06 16:10:22 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*/
@@ -121,11 +121,11 @@ LUA_API void lua_xmove (lua_State *from, lua_State *to, int n) {
121 lua_lock(to); 121 lua_lock(to);
122 api_checknelems(from, n); 122 api_checknelems(from, n);
123 api_check(from, G(from) == G(to), "moving among independent states"); 123 api_check(from, G(from) == G(to), "moving among independent states");
124 api_check(from, to->ci->top - to->top >= n, "not enough elements to move"); 124 api_check(from, to->ci->top - to->top >= n, "stack overflow");
125 from->top -= n; 125 from->top -= n;
126 for (i = 0; i < n; i++) { 126 for (i = 0; i < n; i++) {
127 setobj2s(to, to->top, from->top + i); 127 setobj2s(to, to->top, from->top + i);
128 api_incr_top(to); 128 to->top++; /* stack already checked by previous 'api_check' */
129 } 129 }
130 lua_unlock(to); 130 lua_unlock(to);
131} 131}
@@ -918,10 +918,10 @@ LUA_API void lua_callk (lua_State *L, int nargs, int nresults,
918 if (k != NULL && L->nny == 0) { /* need to prepare continuation? */ 918 if (k != NULL && L->nny == 0) { /* need to prepare continuation? */
919 L->ci->u.c.k = k; /* save continuation */ 919 L->ci->u.c.k = k; /* save continuation */
920 L->ci->u.c.ctx = ctx; /* save context */ 920 L->ci->u.c.ctx = ctx; /* save context */
921 luaD_call(L, func, nresults, 1); /* do the call */ 921 luaD_call(L, func, nresults); /* do the call */
922 } 922 }
923 else /* no continuation or no yieldable */ 923 else /* no continuation or no yieldable */
924 luaD_call(L, func, nresults, 0); /* just do the call */ 924 luaD_callnoyield(L, func, nresults); /* just do the call */
925 adjustresults(L, nresults); 925 adjustresults(L, nresults);
926 lua_unlock(L); 926 lua_unlock(L);
927} 927}
@@ -939,7 +939,7 @@ struct CallS { /* data to 'f_call' */
939 939
940static void f_call (lua_State *L, void *ud) { 940static void f_call (lua_State *L, void *ud) {
941 struct CallS *c = cast(struct CallS *, ud); 941 struct CallS *c = cast(struct CallS *, ud);
942 luaD_call(L, c->func, c->nresults, 0); 942 luaD_callnoyield(L, c->func, c->nresults);
943} 943}
944 944
945 945
@@ -977,7 +977,7 @@ LUA_API int lua_pcallk (lua_State *L, int nargs, int nresults, int errfunc,
977 L->errfunc = func; 977 L->errfunc = func;
978 setoah(ci->callstatus, L->allowhook); /* save value of 'allowhook' */ 978 setoah(ci->callstatus, L->allowhook); /* save value of 'allowhook' */
979 ci->callstatus |= CIST_YPCALL; /* function can do error recovery */ 979 ci->callstatus |= CIST_YPCALL; /* function can do error recovery */
980 luaD_call(L, c.func, nresults, 1); /* do the call */ 980 luaD_call(L, c.func, nresults); /* do the call */
981 ci->callstatus &= ~CIST_YPCALL; 981 ci->callstatus &= ~CIST_YPCALL;
982 L->errfunc = ci->u.c.old_errfunc; 982 L->errfunc = ci->u.c.old_errfunc;
983 status = LUA_OK; /* if it is here, there were no errors */ 983 status = LUA_OK; /* if it is here, there were no errors */