Changeset

6620:50eaefeec013

util-src/*.c: Per convention call luaL_error() as argument to return
author Florian Zeitz <florob@babelmonkeys.de>
date Fri, 03 Apr 2015 20:30:14 +0200
parents 6619:78d1706982b2
children 6621:352fa2cae1c9 6622:fb60cee2144e
files util-src/hashes.c util-src/pposix.c util-src/signal.c
diffstat 3 files changed, 6 insertions(+), 5 deletions(-) [+]
line wrap: on
line diff
--- a/util-src/hashes.c	Fri Apr 03 19:31:05 2015 +0100
+++ b/util-src/hashes.c	Fri Apr 03 20:30:14 2015 +0200
@@ -170,7 +170,7 @@
 	salt2 = malloc(salt_len + 4);
 
 	if(salt2 == NULL) {
-		luaL_error(L, "Out of memory in scramHi");
+		return luaL_error(L, "Out of memory in scramHi");
 	}
 
 	memcpy(salt2, salt, salt_len);
--- a/util-src/pposix.c	Fri Apr 03 19:31:05 2015 +0100
+++ b/util-src/pposix.c	Fri Apr 03 20:30:14 2015 +0200
@@ -708,7 +708,7 @@
 	FILE* f = *(FILE**) luaL_checkudata(L, 1, LUA_FILEHANDLE);
 
 	if(f == NULL) {
-		luaL_error(L, "attempt to use a closed file");
+		return luaL_error(L, "attempt to use a closed file");
 	}
 
 	offset = luaL_checkinteger(L, 2);
--- a/util-src/signal.c	Fri Apr 03 19:31:05 2015 +0100
+++ b/util-src/signal.c	Fri Apr 03 20:30:14 2015 +0200
@@ -237,13 +237,14 @@
 		lua_gettable(L, -2);
 
 		if(!lua_isnumber(L, -1)) {
-			luaL_error(L, "invalid signal string");
+			return luaL_error(L, "invalid signal string");
 		}
 
 		sig = (int) lua_tonumber(L, -1);
 		lua_pop(L, 1); /* get rid of number we pushed */
 	} else {
 		luaL_checknumber(L, 1);    /* will always error, with good error msg */
+		return luaL_error(L, "unreachable: invalid number was accepted");
 	}
 
 	/* set handler */
@@ -313,7 +314,7 @@
 		lua_gettable(L, -2);
 
 		if(!lua_isnumber(L, -1)) {
-			luaL_error(L, "invalid signal string");
+			return luaL_error(L, "invalid signal string");
 		}
 
 		ret = (lua_Number) raise((int) lua_tonumber(L, -1));
@@ -357,7 +358,7 @@
 		lua_gettable(L, -2);
 
 		if(!lua_isnumber(L, -1)) {
-			luaL_error(L, "invalid signal string");
+			return luaL_error(L, "invalid signal string");
 		}
 
 		ret = (lua_Number) kill((int) lua_tonumber(L, 1),