diff options
Diffstat (limited to 'lapi.c')
-rw-r--r-- | lapi.c | 26 |
1 files changed, 13 insertions, 13 deletions
@@ -58,7 +58,7 @@ static void advancegc (lua_State *L, size_t delta) { | |||
58 | delta >>= 5; /* one object for each 32 bytes (empirical) */ | 58 | delta >>= 5; /* one object for each 32 bytes (empirical) */ |
59 | if (delta > 0) { | 59 | if (delta > 0) { |
60 | global_State *g = G(L); | 60 | global_State *g = G(L); |
61 | luaE_setdebt(g, g->GCdebt - delta); | 61 | luaE_setdebt(g, g->GCdebt - cast(l_obj, delta)); |
62 | } | 62 | } |
63 | } | 63 | } |
64 | 64 | ||
@@ -437,9 +437,9 @@ LUA_API const char *lua_tolstring (lua_State *L, int idx, size_t *len) { | |||
437 | LUA_API lua_Unsigned lua_rawlen (lua_State *L, int idx) { | 437 | LUA_API lua_Unsigned lua_rawlen (lua_State *L, int idx) { |
438 | const TValue *o = index2value(L, idx); | 438 | const TValue *o = index2value(L, idx); |
439 | switch (ttypetag(o)) { | 439 | switch (ttypetag(o)) { |
440 | case LUA_VSHRSTR: return tsvalue(o)->shrlen; | 440 | case LUA_VSHRSTR: return cast(lua_Unsigned, tsvalue(o)->shrlen); |
441 | case LUA_VLNGSTR: return tsvalue(o)->u.lnglen; | 441 | case LUA_VLNGSTR: return cast(lua_Unsigned, tsvalue(o)->u.lnglen); |
442 | case LUA_VUSERDATA: return uvalue(o)->len; | 442 | case LUA_VUSERDATA: return cast(lua_Unsigned, uvalue(o)->len); |
443 | case LUA_VTABLE: return luaH_getn(hvalue(o)); | 443 | case LUA_VTABLE: return luaH_getn(hvalue(o)); |
444 | default: return 0; | 444 | default: return 0; |
445 | } | 445 | } |
@@ -667,7 +667,7 @@ LUA_API int lua_pushthread (lua_State *L) { | |||
667 | 667 | ||
668 | 668 | ||
669 | static int auxgetstr (lua_State *L, const TValue *t, const char *k) { | 669 | static int auxgetstr (lua_State *L, const TValue *t, const char *k) { |
670 | int tag; | 670 | lu_byte tag; |
671 | TString *str = luaS_new(L, k); | 671 | TString *str = luaS_new(L, k); |
672 | luaV_fastget(t, str, s2v(L->top.p), luaH_getstr, tag); | 672 | luaV_fastget(t, str, s2v(L->top.p), luaH_getstr, tag); |
673 | if (!tagisempty(tag)) { | 673 | if (!tagisempty(tag)) { |
@@ -685,7 +685,7 @@ static int auxgetstr (lua_State *L, const TValue *t, const char *k) { | |||
685 | 685 | ||
686 | static void getGlobalTable (lua_State *L, TValue *gt) { | 686 | static void getGlobalTable (lua_State *L, TValue *gt) { |
687 | Table *registry = hvalue(&G(L)->l_registry); | 687 | Table *registry = hvalue(&G(L)->l_registry); |
688 | int tag = luaH_getint(registry, LUA_RIDX_GLOBALS, gt); | 688 | lu_byte tag = luaH_getint(registry, LUA_RIDX_GLOBALS, gt); |
689 | (void)tag; /* avoid not-used warnings when checks are off */ | 689 | (void)tag; /* avoid not-used warnings when checks are off */ |
690 | api_check(L, novariant(tag) == LUA_TTABLE, "global table must exist"); | 690 | api_check(L, novariant(tag) == LUA_TTABLE, "global table must exist"); |
691 | } | 691 | } |
@@ -700,7 +700,7 @@ LUA_API int lua_getglobal (lua_State *L, const char *name) { | |||
700 | 700 | ||
701 | 701 | ||
702 | LUA_API int lua_gettable (lua_State *L, int idx) { | 702 | LUA_API int lua_gettable (lua_State *L, int idx) { |
703 | int tag; | 703 | lu_byte tag; |
704 | TValue *t; | 704 | TValue *t; |
705 | lua_lock(L); | 705 | lua_lock(L); |
706 | api_checkpop(L, 1); | 706 | api_checkpop(L, 1); |
@@ -721,7 +721,7 @@ LUA_API int lua_getfield (lua_State *L, int idx, const char *k) { | |||
721 | 721 | ||
722 | LUA_API int lua_geti (lua_State *L, int idx, lua_Integer n) { | 722 | LUA_API int lua_geti (lua_State *L, int idx, lua_Integer n) { |
723 | TValue *t; | 723 | TValue *t; |
724 | int tag; | 724 | lu_byte tag; |
725 | lua_lock(L); | 725 | lua_lock(L); |
726 | t = index2value(L, idx); | 726 | t = index2value(L, idx); |
727 | luaV_fastgeti(t, n, s2v(L->top.p), tag); | 727 | luaV_fastgeti(t, n, s2v(L->top.p), tag); |
@@ -736,7 +736,7 @@ LUA_API int lua_geti (lua_State *L, int idx, lua_Integer n) { | |||
736 | } | 736 | } |
737 | 737 | ||
738 | 738 | ||
739 | static int finishrawget (lua_State *L, int tag) { | 739 | static int finishrawget (lua_State *L, lu_byte tag) { |
740 | if (tagisempty(tag)) /* avoid copying empty items to the stack */ | 740 | if (tagisempty(tag)) /* avoid copying empty items to the stack */ |
741 | setnilvalue(s2v(L->top.p)); | 741 | setnilvalue(s2v(L->top.p)); |
742 | api_incr_top(L); | 742 | api_incr_top(L); |
@@ -754,7 +754,7 @@ l_sinline Table *gettable (lua_State *L, int idx) { | |||
754 | 754 | ||
755 | LUA_API int lua_rawget (lua_State *L, int idx) { | 755 | LUA_API int lua_rawget (lua_State *L, int idx) { |
756 | Table *t; | 756 | Table *t; |
757 | int tag; | 757 | lu_byte tag; |
758 | lua_lock(L); | 758 | lua_lock(L); |
759 | api_checkpop(L, 1); | 759 | api_checkpop(L, 1); |
760 | t = gettable(L, idx); | 760 | t = gettable(L, idx); |
@@ -766,7 +766,7 @@ LUA_API int lua_rawget (lua_State *L, int idx) { | |||
766 | 766 | ||
767 | LUA_API int lua_rawgeti (lua_State *L, int idx, lua_Integer n) { | 767 | LUA_API int lua_rawgeti (lua_State *L, int idx, lua_Integer n) { |
768 | Table *t; | 768 | Table *t; |
769 | int tag; | 769 | lu_byte tag; |
770 | lua_lock(L); | 770 | lua_lock(L); |
771 | t = gettable(L, idx); | 771 | t = gettable(L, idx); |
772 | luaH_fastgeti(t, n, s2v(L->top.p), tag); | 772 | luaH_fastgeti(t, n, s2v(L->top.p), tag); |
@@ -1231,7 +1231,7 @@ LUA_API int lua_gc (lua_State *L, int what, ...) { | |||
1231 | api_check(L, 0 <= param && param < LUA_GCPN, "invalid parameter"); | 1231 | api_check(L, 0 <= param && param < LUA_GCPN, "invalid parameter"); |
1232 | res = cast_int(luaO_applyparam(g->gcparams[param], 100)); | 1232 | res = cast_int(luaO_applyparam(g->gcparams[param], 100)); |
1233 | if (value >= 0) | 1233 | if (value >= 0) |
1234 | g->gcparams[param] = luaO_codeparam(value); | 1234 | g->gcparams[param] = luaO_codeparam(cast_uint(value)); |
1235 | break; | 1235 | break; |
1236 | } | 1236 | } |
1237 | default: res = -1; /* invalid option */ | 1237 | default: res = -1; /* invalid option */ |
@@ -1353,7 +1353,7 @@ LUA_API void *lua_newuserdatauv (lua_State *L, size_t size, int nuvalue) { | |||
1353 | Udata *u; | 1353 | Udata *u; |
1354 | lua_lock(L); | 1354 | lua_lock(L); |
1355 | api_check(L, 0 <= nuvalue && nuvalue < USHRT_MAX, "invalid value"); | 1355 | api_check(L, 0 <= nuvalue && nuvalue < USHRT_MAX, "invalid value"); |
1356 | u = luaS_newudata(L, size, nuvalue); | 1356 | u = luaS_newudata(L, size, cast(unsigned short, nuvalue)); |
1357 | setuvalue(L, s2v(L->top.p), u); | 1357 | setuvalue(L, s2v(L->top.p), u); |
1358 | api_incr_top(L); | 1358 | api_incr_top(L); |
1359 | advancegc(L, size); | 1359 | advancegc(L, size); |