aboutsummaryrefslogtreecommitdiff
path: root/lapi.c
diff options
context:
space:
mode:
Diffstat (limited to 'lapi.c')
-rw-r--r--lapi.c19
1 files changed, 11 insertions, 8 deletions
diff --git a/lapi.c b/lapi.c
index d18445e0..74f1d66b 100644
--- a/lapi.c
+++ b/lapi.c
@@ -102,7 +102,7 @@ static TValue *index2value (lua_State *L, int idx) {
102/* 102/*
103** Convert a valid actual index (not a pseudo-index) to its address. 103** Convert a valid actual index (not a pseudo-index) to its address.
104*/ 104*/
105l_sinline StkId index2stack (lua_State *L, int idx) { 105static StkId index2stack (lua_State *L, int idx) {
106 CallInfo *ci = L->ci; 106 CallInfo *ci = L->ci;
107 if (idx > 0) { 107 if (idx > 0) {
108 StkId o = ci->func.p + idx; 108 StkId o = ci->func.p + idx;
@@ -234,7 +234,7 @@ LUA_API void lua_closeslot (lua_State *L, int idx) {
234** Note that we move(copy) only the value inside the stack. 234** Note that we move(copy) only the value inside the stack.
235** (We do not move additional fields that may exist.) 235** (We do not move additional fields that may exist.)
236*/ 236*/
237l_sinline void reverse (lua_State *L, StkId from, StkId to) { 237static void reverse (lua_State *L, StkId from, StkId to) {
238 for (; from < to; from++, to--) { 238 for (; from < to; from++, to--) {
239 TValue temp; 239 TValue temp;
240 setobj(L, &temp, s2v(from)); 240 setobj(L, &temp, s2v(from));
@@ -664,7 +664,7 @@ LUA_API int lua_pushthread (lua_State *L) {
664*/ 664*/
665 665
666 666
667l_sinline int auxgetstr (lua_State *L, const TValue *t, const char *k) { 667static int auxgetstr (lua_State *L, const TValue *t, const char *k) {
668 int hres; 668 int hres;
669 TString *str = luaS_new(L, k); 669 TString *str = luaS_new(L, k);
670 luaV_fastget(t, str, s2v(L->top.p), luaH_getstr, hres); 670 luaV_fastget(t, str, s2v(L->top.p), luaH_getstr, hres);
@@ -683,7 +683,9 @@ l_sinline int auxgetstr (lua_State *L, const TValue *t, const char *k) {
683 683
684static void getGlobalTable (lua_State *L, TValue *gt) { 684static void getGlobalTable (lua_State *L, TValue *gt) {
685 Table *registry = hvalue(&G(L)->l_registry); 685 Table *registry = hvalue(&G(L)->l_registry);
686 luaH_getint(registry, LUA_RIDX_GLOBALS, gt); 686 int hres = luaH_getint(registry, LUA_RIDX_GLOBALS, gt);
687 (void)hres; /* avoid warnings (not used) when checks are off */
688 api_check(L, hres == HOK, "global table must exist");
687} 689}
688 690
689 691
@@ -740,7 +742,7 @@ l_sinline int finishrawget (lua_State *L, int hres) {
740} 742}
741 743
742 744
743static Table *gettable (lua_State *L, int idx) { 745l_sinline Table *gettable (lua_State *L, int idx) {
744 TValue *t = index2value(L, idx); 746 TValue *t = index2value(L, idx);
745 api_check(L, ttistable(t), "table expected"); 747 api_check(L, ttistable(t), "table expected");
746 return hvalue(t); 748 return hvalue(t);
@@ -761,9 +763,11 @@ LUA_API int lua_rawget (lua_State *L, int idx) {
761 763
762LUA_API int lua_rawgeti (lua_State *L, int idx, lua_Integer n) { 764LUA_API int lua_rawgeti (lua_State *L, int idx, lua_Integer n) {
763 Table *t; 765 Table *t;
766 int hres;
764 lua_lock(L); 767 lua_lock(L);
765 t = gettable(L, idx); 768 t = gettable(L, idx);
766 return finishrawget(L, luaH_getint(t, n, s2v(L->top.p))); 769 luaH_fastgeti(t, n, s2v(L->top.p), hres);
770 return finishrawget(L, hres);
767} 771}
768 772
769 773
@@ -901,9 +905,8 @@ LUA_API void lua_seti (lua_State *L, int idx, lua_Integer n) {
901 api_checknelems(L, 1); 905 api_checknelems(L, 1);
902 t = index2value(L, idx); 906 t = index2value(L, idx);
903 luaV_fastseti(t, n, s2v(L->top.p - 1), hres); 907 luaV_fastseti(t, n, s2v(L->top.p - 1), hres);
904 if (hres == HOK) { 908 if (hres == HOK)
905 luaV_finishfastset(L, t, s2v(L->top.p - 1)); 909 luaV_finishfastset(L, t, s2v(L->top.p - 1));
906 }
907 else { 910 else {
908 TValue temp; 911 TValue temp;
909 setivalue(&temp, n); 912 setivalue(&temp, n);