util.encodings: Fixed: Last change was not ANSI C compatible.

Fri, 02 Oct 2009 16:44:14 +0500

author
Waqas Hussain <waqas20@gmail.com>
date
Fri, 02 Oct 2009 16:44:14 +0500
changeset 1854
7e055cc6bc90
parent 1838
8abe1d19c878
child 1855
63b5e7ec6840

util.encodings: Fixed: Last change was not ANSI C compatible.

util-src/encodings.c file | annotate | diff | comparison | revisions
--- a/util-src/encodings.c	Sun Sep 27 13:19:40 2009 +0100
+++ b/util-src/encodings.c	Fri Oct 02 16:44:14 2009 +0500
@@ -125,9 +125,14 @@
 static int stringprep_prep(lua_State *L, const Stringprep_profile *profile)
 {
 	size_t len;
-	const char *s = luaL_checklstring(L, 1, &len);
+	const char *s;
 	char string[1024];
 	int ret;
+	if(!lua_isstring(L, 1)) {
+		lua_pushnil(L);
+		return 1;
+	}
+	s = lua_tolstring(L, 1, &len);
 	if (len >= 1024) {
 		lua_pushnil(L);
 		return 1; // TODO return error message

mercurial