diff options
| author | Roberto Ierusalimschy <roberto@inf.puc-rio.br> | 2011-11-16 16:51:36 -0200 |
|---|---|---|
| committer | Roberto Ierusalimschy <roberto@inf.puc-rio.br> | 2011-11-16 16:51:36 -0200 |
| commit | b5d7255034c3a1fa2f12b7285052c39014c497aa (patch) | |
| tree | 173650dd3a3c27d1dbdf7e3304fcbd5b51ba1111 | |
| parent | 6cce5c060186c109d5fc87ac13b5d36d9d3997ea (diff) | |
| download | lua-b5d7255034c3a1fa2f12b7285052c39014c497aa.tar.gz lua-b5d7255034c3a1fa2f12b7285052c39014c497aa.tar.bz2 lua-b5d7255034c3a1fa2f12b7285052c39014c497aa.zip | |
small changes to avoid some warnings
Diffstat (limited to '')
| -rw-r--r-- | lapi.c | 14 |
1 files changed, 5 insertions, 9 deletions
| @@ -1,5 +1,5 @@ | |||
| 1 | /* | 1 | /* |
| 2 | ** $Id: lapi.c,v 2.155 2011/10/24 16:53:05 roberto Exp roberto $ | 2 | ** $Id: lapi.c,v 2.156 2011/10/31 17:48:51 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 | */ |
| @@ -1182,7 +1182,6 @@ LUA_API void *lua_newuserdata (lua_State *L, size_t size) { | |||
| 1182 | 1182 | ||
| 1183 | 1183 | ||
| 1184 | 1184 | ||
| 1185 | |||
| 1186 | static const char *aux_upvalue (StkId fi, int n, TValue **val, | 1185 | static const char *aux_upvalue (StkId fi, int n, TValue **val, |
| 1187 | GCObject **owner) { | 1186 | GCObject **owner) { |
| 1188 | switch (ttype(fi)) { | 1187 | switch (ttype(fi)) { |
| @@ -1201,10 +1200,7 @@ static const char *aux_upvalue (StkId fi, int n, TValue **val, | |||
| 1201 | *val = f->upvals[n-1]->v; | 1200 | *val = f->upvals[n-1]->v; |
| 1202 | if (owner) *owner = obj2gco(f->upvals[n - 1]); | 1201 | if (owner) *owner = obj2gco(f->upvals[n - 1]); |
| 1203 | name = p->upvalues[n-1].name; | 1202 | name = p->upvalues[n-1].name; |
| 1204 | if (name == NULL) /* no debug information? */ | 1203 | return (name == NULL) ? "" : getstr(name); |
| 1205 | return ""; | ||
| 1206 | else | ||
| 1207 | return getstr(name); | ||
| 1208 | } | 1204 | } |
| 1209 | default: return NULL; /* not a closure */ | 1205 | default: return NULL; /* not a closure */ |
| 1210 | } | 1206 | } |
| @@ -1213,7 +1209,7 @@ static const char *aux_upvalue (StkId fi, int n, TValue **val, | |||
| 1213 | 1209 | ||
| 1214 | LUA_API const char *lua_getupvalue (lua_State *L, int funcindex, int n) { | 1210 | LUA_API const char *lua_getupvalue (lua_State *L, int funcindex, int n) { |
| 1215 | const char *name; | 1211 | const char *name; |
| 1216 | TValue *val; | 1212 | TValue *val = NULL; /* initialized to avoid warnings */ |
| 1217 | lua_lock(L); | 1213 | lua_lock(L); |
| 1218 | name = aux_upvalue(index2addr(L, funcindex), n, &val, NULL); | 1214 | name = aux_upvalue(index2addr(L, funcindex), n, &val, NULL); |
| 1219 | if (name) { | 1215 | if (name) { |
| @@ -1227,8 +1223,8 @@ LUA_API const char *lua_getupvalue (lua_State *L, int funcindex, int n) { | |||
| 1227 | 1223 | ||
| 1228 | LUA_API const char *lua_setupvalue (lua_State *L, int funcindex, int n) { | 1224 | LUA_API const char *lua_setupvalue (lua_State *L, int funcindex, int n) { |
| 1229 | const char *name; | 1225 | const char *name; |
| 1230 | TValue *val; | 1226 | TValue *val = NULL; /* initialized to avoid warnings */ |
| 1231 | GCObject *owner; | 1227 | GCObject *owner = NULL; /* initialized to avoid warnings */ |
| 1232 | StkId fi; | 1228 | StkId fi; |
| 1233 | lua_lock(L); | 1229 | lua_lock(L); |
| 1234 | fi = index2addr(L, funcindex); | 1230 | fi = index2addr(L, funcindex); |
