From e21b26a964774e29f24e5f6ae97808fdb5bce9d5 Mon Sep 17 00:00:00 2001 From: Roberto Ierusalimschy Date: Wed, 30 Nov 2011 10:42:49 -0200 Subject: avoid 'return' "to avoid warnings" --- lbaselib.c | 12 ++++-------- 1 file changed, 4 insertions(+), 8 deletions(-) (limited to 'lbaselib.c') diff --git a/lbaselib.c b/lbaselib.c index ccc3123a..ce868ef7 100644 --- a/lbaselib.c +++ b/lbaselib.c @@ -1,5 +1,5 @@ /* -** $Id: lbaselib.c,v 1.270 2011/11/23 17:29:04 roberto Exp roberto $ +** $Id: lbaselib.c,v 1.271 2011/11/29 15:55:08 roberto Exp roberto $ ** Basic library ** See Copyright Notice in lua.h */ @@ -297,14 +297,10 @@ static const char *generic_reader (lua_State *L, void *ud, size_t *size) { *size = 0; return NULL; } - else if ((s = lua_tostring(L, -1)) != NULL) { - lua_replace(L, RESERVEDSLOT); /* save string in reserved slot */ - return lua_tolstring(L, RESERVEDSLOT, size); - } - else { + else if ((s = lua_tostring(L, -1)) == NULL) luaL_error(L, "reader function must return a string"); - return NULL; /* to avoid warnings */ - } + lua_replace(L, RESERVEDSLOT); /* save string in reserved slot */ + return lua_tolstring(L, RESERVEDSLOT, size); } -- cgit v1.2.3-55-g6feb