aboutsummaryrefslogtreecommitdiff
path: root/lapi.c
diff options
context:
space:
mode:
authorRoberto Ierusalimschy <roberto@inf.puc-rio.br>2017-06-01 17:22:33 -0300
committerRoberto Ierusalimschy <roberto@inf.puc-rio.br>2017-06-01 17:22:33 -0300
commitb029e7ea2070b834e1061492367faa11a1d54e3c (patch)
treeee1e411a0e05e34273ecf20dd5c0a203c081be56 /lapi.c
parent4bc33d64de9bb2c1cd96240337ba8486300759da (diff)
downloadlua-b029e7ea2070b834e1061492367faa11a1d54e3c.tar.gz
lua-b029e7ea2070b834e1061492367faa11a1d54e3c.tar.bz2
lua-b029e7ea2070b834e1061492367faa11a1d54e3c.zip
macro 'luaV_fastget' may need protection ({}) to be used inside
'if's
Diffstat (limited to 'lapi.c')
-rw-r--r--lapi.c8
1 files changed, 5 insertions, 3 deletions
diff --git a/lapi.c b/lapi.c
index 0c109e1e..d78d9455 100644
--- a/lapi.c
+++ b/lapi.c
@@ -1,5 +1,5 @@
1/* 1/*
2** $Id: lapi.c,v 2.267 2017/05/18 12:34:58 roberto Exp roberto $ 2** $Id: lapi.c,v 2.268 2017/05/26 19:14:29 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*/
@@ -775,8 +775,9 @@ LUA_API void lua_settable (lua_State *L, int idx) {
775 lua_lock(L); 775 lua_lock(L);
776 api_checknelems(L, 2); 776 api_checknelems(L, 2);
777 t = index2addr(L, idx); 777 t = index2addr(L, idx);
778 if (luaV_fastget(L, t, L->top - 2, slot, luaH_get)) 778 if (luaV_fastget(L, t, L->top - 2, slot, luaH_get)) {
779 luaV_finishfastset(L, t, slot, L->top - 1); 779 luaV_finishfastset(L, t, slot, L->top - 1);
780 }
780 else 781 else
781 luaV_finishset(L, t, L->top - 2, L->top - 1, slot); 782 luaV_finishset(L, t, L->top - 2, L->top - 1, slot);
782 L->top -= 2; /* pop index and value */ 783 L->top -= 2; /* pop index and value */
@@ -796,8 +797,9 @@ LUA_API void lua_seti (lua_State *L, int idx, lua_Integer n) {
796 lua_lock(L); 797 lua_lock(L);
797 api_checknelems(L, 1); 798 api_checknelems(L, 1);
798 t = index2addr(L, idx); 799 t = index2addr(L, idx);
799 if (luaV_fastgeti(L, t, n, slot)) 800 if (luaV_fastgeti(L, t, n, slot)) {
800 luaV_finishfastset(L, t, slot, L->top - 1); 801 luaV_finishfastset(L, t, slot, L->top - 1);
802 }
801 else { 803 else {
802 TValue aux; 804 TValue aux;
803 setivalue(&aux, n); 805 setivalue(&aux, n);