diff options
author | Mike Pall <mike> | 2017-04-07 12:12:03 +0200 |
---|---|---|
committer | Mike Pall <mike> | 2017-04-07 12:12:03 +0200 |
commit | 9c685f7003388725c91ef38627113015676b6d65 (patch) | |
tree | 6f7538b8073a9c74ae8d2846e1c3c6f20a68523a /src/lib_base.c | |
parent | 22dfa63283276d5dc13205680bda961ec671aef6 (diff) | |
download | luajit-9c685f7003388725c91ef38627113015676b6d65.tar.gz luajit-9c685f7003388725c91ef38627113015676b6d65.tar.bz2 luajit-9c685f7003388725c91ef38627113015676b6d65.zip |
Refactor with LUA_OK.
Contributed by François Perrad.
Diffstat (limited to 'src/lib_base.c')
-rw-r--r-- | src/lib_base.c | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/src/lib_base.c b/src/lib_base.c index 44014f9b..3a757870 100644 --- a/src/lib_base.c +++ b/src/lib_base.c | |||
@@ -346,7 +346,7 @@ LJLIB_ASM_(xpcall) LJLIB_REC(.) | |||
346 | 346 | ||
347 | static int load_aux(lua_State *L, int status, int envarg) | 347 | static int load_aux(lua_State *L, int status, int envarg) |
348 | { | 348 | { |
349 | if (status == 0) { | 349 | if (status == LUA_OK) { |
350 | if (tvistab(L->base+envarg-1)) { | 350 | if (tvistab(L->base+envarg-1)) { |
351 | GCfunc *fn = funcV(L->top-1); | 351 | GCfunc *fn = funcV(L->top-1); |
352 | GCtab *t = tabV(L->base+envarg-1); | 352 | GCtab *t = tabV(L->base+envarg-1); |
@@ -419,7 +419,7 @@ LJLIB_CF(dofile) | |||
419 | GCstr *fname = lj_lib_optstr(L, 1); | 419 | GCstr *fname = lj_lib_optstr(L, 1); |
420 | setnilV(L->top); | 420 | setnilV(L->top); |
421 | L->top = L->base+1; | 421 | L->top = L->base+1; |
422 | if (luaL_loadfile(L, fname ? strdata(fname) : NULL) != 0) | 422 | if (luaL_loadfile(L, fname ? strdata(fname) : NULL) != LUA_OK) |
423 | lua_error(L); | 423 | lua_error(L); |
424 | lua_call(L, 0, LUA_MULTRET); | 424 | lua_call(L, 0, LUA_MULTRET); |
425 | return (int)(L->top - L->base) - 1; | 425 | return (int)(L->top - L->base) - 1; |
@@ -537,7 +537,7 @@ LJLIB_CF(coroutine_status) | |||
537 | co = threadV(L->base); | 537 | co = threadV(L->base); |
538 | if (co == L) s = "running"; | 538 | if (co == L) s = "running"; |
539 | else if (co->status == LUA_YIELD) s = "suspended"; | 539 | else if (co->status == LUA_YIELD) s = "suspended"; |
540 | else if (co->status != 0) s = "dead"; | 540 | else if (co->status != LUA_OK) s = "dead"; |
541 | else if (co->base > tvref(co->stack)+1+LJ_FR2) s = "normal"; | 541 | else if (co->base > tvref(co->stack)+1+LJ_FR2) s = "normal"; |
542 | else if (co->top == co->base) s = "dead"; | 542 | else if (co->top == co->base) s = "dead"; |
543 | else s = "suspended"; | 543 | else s = "suspended"; |
@@ -583,7 +583,7 @@ LJLIB_ASM(coroutine_yield) | |||
583 | static int ffh_resume(lua_State *L, lua_State *co, int wrap) | 583 | static int ffh_resume(lua_State *L, lua_State *co, int wrap) |
584 | { | 584 | { |
585 | if (co->cframe != NULL || co->status > LUA_YIELD || | 585 | if (co->cframe != NULL || co->status > LUA_YIELD || |
586 | (co->status == 0 && co->top == co->base)) { | 586 | (co->status == LUA_OK && co->top == co->base)) { |
587 | ErrMsg em = co->cframe ? LJ_ERR_CORUN : LJ_ERR_CODEAD; | 587 | ErrMsg em = co->cframe ? LJ_ERR_CORUN : LJ_ERR_CODEAD; |
588 | if (wrap) lj_err_caller(L, em); | 588 | if (wrap) lj_err_caller(L, em); |
589 | setboolV(L->base-1-LJ_FR2, 0); | 589 | setboolV(L->base-1-LJ_FR2, 0); |