diff options
| author | Roberto Ierusalimschy <roberto@inf.puc-rio.br> | 2011-11-30 10:42:49 -0200 |
|---|---|---|
| committer | Roberto Ierusalimschy <roberto@inf.puc-rio.br> | 2011-11-30 10:42:49 -0200 |
| commit | e21b26a964774e29f24e5f6ae97808fdb5bce9d5 (patch) | |
| tree | f512c9e2843fdc12c5bba13e17346633893b3dc3 | |
| parent | 0f388193b3d00571126abadfd4dc9bf02ea17b24 (diff) | |
| download | lua-e21b26a964774e29f24e5f6ae97808fdb5bce9d5.tar.gz lua-e21b26a964774e29f24e5f6ae97808fdb5bce9d5.tar.bz2 lua-e21b26a964774e29f24e5f6ae97808fdb5bce9d5.zip | |
avoid 'return' "to avoid warnings"
| -rw-r--r-- | lbaselib.c | 12 | ||||
| -rw-r--r-- | lmem.c | 5 | ||||
| -rw-r--r-- | lmem.h | 6 | ||||
| -rw-r--r-- | ltable.c | 10 |
4 files changed, 14 insertions, 19 deletions
| @@ -1,5 +1,5 @@ | |||
| 1 | /* | 1 | /* |
| 2 | ** $Id: lbaselib.c,v 1.270 2011/11/23 17:29:04 roberto Exp roberto $ | 2 | ** $Id: lbaselib.c,v 1.271 2011/11/29 15:55:08 roberto Exp roberto $ |
| 3 | ** Basic library | 3 | ** Basic library |
| 4 | ** See Copyright Notice in lua.h | 4 | ** See Copyright Notice in lua.h |
| 5 | */ | 5 | */ |
| @@ -297,14 +297,10 @@ static const char *generic_reader (lua_State *L, void *ud, size_t *size) { | |||
| 297 | *size = 0; | 297 | *size = 0; |
| 298 | return NULL; | 298 | return NULL; |
| 299 | } | 299 | } |
| 300 | else if ((s = lua_tostring(L, -1)) != NULL) { | 300 | else if ((s = lua_tostring(L, -1)) == NULL) |
| 301 | lua_replace(L, RESERVEDSLOT); /* save string in reserved slot */ | ||
| 302 | return lua_tolstring(L, RESERVEDSLOT, size); | ||
| 303 | } | ||
| 304 | else { | ||
| 305 | luaL_error(L, "reader function must return a string"); | 301 | luaL_error(L, "reader function must return a string"); |
| 306 | return NULL; /* to avoid warnings */ | 302 | lua_replace(L, RESERVEDSLOT); /* save string in reserved slot */ |
| 307 | } | 303 | return lua_tolstring(L, RESERVEDSLOT, size); |
| 308 | } | 304 | } |
| 309 | 305 | ||
| 310 | 306 | ||
| @@ -1,5 +1,5 @@ | |||
| 1 | /* | 1 | /* |
| 2 | ** $Id: lmem.c,v 1.81 2010/12/20 19:40:07 roberto Exp roberto $ | 2 | ** $Id: lmem.c,v 1.82 2011/09/20 19:25:23 roberto Exp roberto $ |
| 3 | ** Interface to Memory Manager | 3 | ** Interface to Memory Manager |
| 4 | ** See Copyright Notice in lua.h | 4 | ** See Copyright Notice in lua.h |
| 5 | */ | 5 | */ |
| @@ -63,9 +63,8 @@ void *luaM_growaux_ (lua_State *L, void *block, int *size, size_t size_elems, | |||
| 63 | } | 63 | } |
| 64 | 64 | ||
| 65 | 65 | ||
| 66 | void *luaM_toobig (lua_State *L) { | 66 | l_noret luaM_toobig (lua_State *L) { |
| 67 | luaG_runerror(L, "memory allocation error: block too big"); | 67 | luaG_runerror(L, "memory allocation error: block too big"); |
| 68 | return NULL; /* to avoid warnings */ | ||
| 69 | } | 68 | } |
| 70 | 69 | ||
| 71 | 70 | ||
| @@ -1,5 +1,5 @@ | |||
| 1 | /* | 1 | /* |
| 2 | ** $Id: lmem.h,v 1.35 2009/12/16 16:42:58 roberto Exp roberto $ | 2 | ** $Id: lmem.h,v 1.36 2010/04/08 17:16:46 roberto Exp roberto $ |
| 3 | ** Interface to Memory Manager | 3 | ** Interface to Memory Manager |
| 4 | ** See Copyright Notice in lua.h | 4 | ** See Copyright Notice in lua.h |
| 5 | */ | 5 | */ |
| @@ -17,7 +17,7 @@ | |||
| 17 | #define luaM_reallocv(L,b,on,n,e) \ | 17 | #define luaM_reallocv(L,b,on,n,e) \ |
| 18 | ((cast(size_t, (n)+1) <= MAX_SIZET/(e)) ? /* +1 to avoid warnings */ \ | 18 | ((cast(size_t, (n)+1) <= MAX_SIZET/(e)) ? /* +1 to avoid warnings */ \ |
| 19 | luaM_realloc_(L, (b), (on)*(e), (n)*(e)) : \ | 19 | luaM_realloc_(L, (b), (on)*(e), (n)*(e)) : \ |
| 20 | luaM_toobig(L)) | 20 | (luaM_toobig(L), NULL)) |
| 21 | 21 | ||
| 22 | #define luaM_freemem(L, b, s) luaM_realloc_(L, (b), (s), 0) | 22 | #define luaM_freemem(L, b, s) luaM_realloc_(L, (b), (s), 0) |
| 23 | #define luaM_free(L, b) luaM_realloc_(L, (b), sizeof(*(b)), 0) | 23 | #define luaM_free(L, b) luaM_realloc_(L, (b), sizeof(*(b)), 0) |
| @@ -37,7 +37,7 @@ | |||
| 37 | #define luaM_reallocvector(L, v,oldn,n,t) \ | 37 | #define luaM_reallocvector(L, v,oldn,n,t) \ |
| 38 | ((v)=cast(t *, luaM_reallocv(L, v, oldn, n, sizeof(t)))) | 38 | ((v)=cast(t *, luaM_reallocv(L, v, oldn, n, sizeof(t)))) |
| 39 | 39 | ||
| 40 | LUAI_FUNC void *luaM_toobig (lua_State *L); | 40 | LUAI_FUNC l_noret luaM_toobig (lua_State *L); |
| 41 | 41 | ||
| 42 | /* not to be called directly */ | 42 | /* not to be called directly */ |
| 43 | LUAI_FUNC void *luaM_realloc_ (lua_State *L, void *block, size_t oldsize, | 43 | LUAI_FUNC void *luaM_realloc_ (lua_State *L, void *block, size_t oldsize, |
| @@ -1,5 +1,5 @@ | |||
| 1 | /* | 1 | /* |
| 2 | ** $Id: ltable.c,v 2.65 2011/09/30 12:45:27 roberto Exp roberto $ | 2 | ** $Id: ltable.c,v 2.66 2011/11/28 17:25:48 roberto Exp roberto $ |
| 3 | ** Lua tables (hash) | 3 | ** Lua tables (hash) |
| 4 | ** See Copyright Notice in lua.h | 4 | ** See Copyright Notice in lua.h |
| 5 | */ | 5 | */ |
| @@ -141,7 +141,7 @@ static int findindex (lua_State *L, Table *t, StkId key) { | |||
| 141 | return i-1; /* yes; that's the index (corrected to C) */ | 141 | return i-1; /* yes; that's the index (corrected to C) */ |
| 142 | else { | 142 | else { |
| 143 | Node *n = mainposition(t, key); | 143 | Node *n = mainposition(t, key); |
| 144 | do { /* check whether `key' is somewhere in the chain */ | 144 | for (;;) { /* check whether `key' is somewhere in the chain */ |
| 145 | /* key may be dead already, but it is ok to use it in `next' */ | 145 | /* key may be dead already, but it is ok to use it in `next' */ |
| 146 | if (luaV_rawequalobj(gkey(n), key) || | 146 | if (luaV_rawequalobj(gkey(n), key) || |
| 147 | (ttisdeadkey(gkey(n)) && iscollectable(key) && | 147 | (ttisdeadkey(gkey(n)) && iscollectable(key) && |
| @@ -151,9 +151,9 @@ static int findindex (lua_State *L, Table *t, StkId key) { | |||
| 151 | return i + t->sizearray; | 151 | return i + t->sizearray; |
| 152 | } | 152 | } |
| 153 | else n = gnext(n); | 153 | else n = gnext(n); |
| 154 | } while (n); | 154 | if (n == NULL) |
| 155 | luaG_runerror(L, "invalid key to " LUA_QL("next")); /* key not found */ | 155 | luaG_runerror(L, "invalid key to " LUA_QL("next")); /* key not found */ |
| 156 | return 0; /* to avoid warnings */ | 156 | } |
| 157 | } | 157 | } |
| 158 | } | 158 | } |
| 159 | 159 | ||
