aboutsummaryrefslogtreecommitdiff
path: root/lapi.c
diff options
context:
space:
mode:
authorRoberto Ierusalimschy <roberto@inf.puc-rio.br>2010-10-25 17:01:37 -0200
committerRoberto Ierusalimschy <roberto@inf.puc-rio.br>2010-10-25 17:01:37 -0200
commit4590a89b32b62c75fca7ced96c282c7793b8885c (patch)
tree99ec05f9ba4ca157cbc8736d0b923d479065bf54 /lapi.c
parent1475cb59bf16c6af7ecd937e13da0ca0f451a191 (diff)
downloadlua-4590a89b32b62c75fca7ced96c282c7793b8885c.tar.gz
lua-4590a89b32b62c75fca7ced96c282c7793b8885c.tar.bz2
lua-4590a89b32b62c75fca7ced96c282c7793b8885c.zip
corrected warnings from different compilers (mostly casts and small
details)
Diffstat (limited to 'lapi.c')
-rw-r--r--lapi.c8
1 files changed, 3 insertions, 5 deletions
diff --git a/lapi.c b/lapi.c
index 40b15a3c..7a51b657 100644
--- a/lapi.c
+++ b/lapi.c
@@ -1,5 +1,5 @@
1/* 1/*
2** $Id: lapi.c,v 2.136 2010/09/07 19:21:39 roberto Exp roberto $ 2** $Id: lapi.c,v 2.137 2010/09/07 19:35:04 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*/
@@ -85,7 +85,7 @@ LUA_API int lua_checkstack (lua_State *L, int size) {
85 if (L->stack_last - L->top > size) /* stack large enough? */ 85 if (L->stack_last - L->top > size) /* stack large enough? */
86 res = 1; /* yes; check is OK */ 86 res = 1; /* yes; check is OK */
87 else { /* no; need to grow stack */ 87 else { /* no; need to grow stack */
88 int inuse = L->top - L->stack + EXTRA_STACK; 88 int inuse = cast_int(L->top - L->stack) + EXTRA_STACK;
89 if (inuse > LUAI_MAXSTACK - size) /* can grow without overflow? */ 89 if (inuse > LUAI_MAXSTACK - size) /* can grow without overflow? */
90 res = 0; /* no */ 90 res = 0; /* no */
91 else /* try to grow stack */ 91 else /* try to grow stack */
@@ -1155,13 +1155,11 @@ LUA_API const char *lua_setupvalue (lua_State *L, int funcindex, int n) {
1155 1155
1156static UpVal **getupvalref (lua_State *L, int fidx, int n, Closure **pf) { 1156static UpVal **getupvalref (lua_State *L, int fidx, int n, Closure **pf) {
1157 Closure *f; 1157 Closure *f;
1158 Proto *p;
1159 StkId fi = index2addr(L, fidx); 1158 StkId fi = index2addr(L, fidx);
1160 api_check(L, ttisclosure(fi), "Lua function expected"); 1159 api_check(L, ttisclosure(fi), "Lua function expected");
1161 f = clvalue(fi); 1160 f = clvalue(fi);
1162 api_check(L, !f->c.isC, "Lua function expected"); 1161 api_check(L, !f->c.isC, "Lua function expected");
1163 p = f->l.p; 1162 api_check(L, (1 <= n && n <= f->l.p->sizeupvalues), "invalid upvalue index");
1164 api_check(L, (1 <= n && n <= p->sizeupvalues), "invalid upvalue index");
1165 if (pf) *pf = f; 1163 if (pf) *pf = f;
1166 return &f->l.upvals[n - 1]; /* get its upvalue pointer */ 1164 return &f->l.upvals[n - 1]; /* get its upvalue pointer */
1167} 1165}