diff options
Diffstat (limited to '')
| -rw-r--r-- | src/lua/lcorolib.c | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/src/lua/lcorolib.c b/src/lua/lcorolib.c index ed7c58b..fedbebe 100644 --- a/src/lua/lcorolib.c +++ b/src/lua/lcorolib.c | |||
| @@ -31,14 +31,14 @@ static lua_State *getco (lua_State *L) { | |||
| 31 | */ | 31 | */ |
| 32 | static int auxresume (lua_State *L, lua_State *co, int narg) { | 32 | static int auxresume (lua_State *L, lua_State *co, int narg) { |
| 33 | int status, nres; | 33 | int status, nres; |
| 34 | if (!lua_checkstack(co, narg)) { | 34 | if (l_unlikely(!lua_checkstack(co, narg))) { |
| 35 | lua_pushliteral(L, "too many arguments to resume"); | 35 | lua_pushliteral(L, "too many arguments to resume"); |
| 36 | return -1; /* error flag */ | 36 | return -1; /* error flag */ |
| 37 | } | 37 | } |
| 38 | lua_xmove(L, co, narg); | 38 | lua_xmove(L, co, narg); |
| 39 | status = lua_resume(co, L, narg, &nres); | 39 | status = lua_resume(co, L, narg, &nres); |
| 40 | if (status == LUA_OK || status == LUA_YIELD) { | 40 | if (l_likely(status == LUA_OK || status == LUA_YIELD)) { |
| 41 | if (!lua_checkstack(L, nres + 1)) { | 41 | if (l_unlikely(!lua_checkstack(L, nres + 1))) { |
| 42 | lua_pop(co, nres); /* remove results anyway */ | 42 | lua_pop(co, nres); /* remove results anyway */ |
| 43 | lua_pushliteral(L, "too many results to resume"); | 43 | lua_pushliteral(L, "too many results to resume"); |
| 44 | return -1; /* error flag */ | 44 | return -1; /* error flag */ |
| @@ -57,7 +57,7 @@ static int luaB_coresume (lua_State *L) { | |||
| 57 | lua_State *co = getco(L); | 57 | lua_State *co = getco(L); |
| 58 | int r; | 58 | int r; |
| 59 | r = auxresume(L, co, lua_gettop(L) - 1); | 59 | r = auxresume(L, co, lua_gettop(L) - 1); |
| 60 | if (r < 0) { | 60 | if (l_unlikely(r < 0)) { |
| 61 | lua_pushboolean(L, 0); | 61 | lua_pushboolean(L, 0); |
| 62 | lua_insert(L, -2); | 62 | lua_insert(L, -2); |
| 63 | return 2; /* return false + error message */ | 63 | return 2; /* return false + error message */ |
| @@ -73,7 +73,7 @@ static int luaB_coresume (lua_State *L) { | |||
| 73 | static int luaB_auxwrap (lua_State *L) { | 73 | static int luaB_auxwrap (lua_State *L) { |
| 74 | lua_State *co = lua_tothread(L, lua_upvalueindex(1)); | 74 | lua_State *co = lua_tothread(L, lua_upvalueindex(1)); |
| 75 | int r = auxresume(L, co, lua_gettop(L)); | 75 | int r = auxresume(L, co, lua_gettop(L)); |
| 76 | if (r < 0) { /* error? */ | 76 | if (l_unlikely(r < 0)) { /* error? */ |
| 77 | int stat = lua_status(co); | 77 | int stat = lua_status(co); |
| 78 | if (stat != LUA_OK && stat != LUA_YIELD) { /* error in the coroutine? */ | 78 | if (stat != LUA_OK && stat != LUA_YIELD) { /* error in the coroutine? */ |
| 79 | stat = lua_resetthread(co); /* close its tbc variables */ | 79 | stat = lua_resetthread(co); /* close its tbc variables */ |
