From 8396a0291b2d97bc837c4c55bb99f7f6777ce515 Mon Sep 17 00:00:00 2001 From: Diego Nehab Date: Sun, 1 Mar 2015 22:49:04 -0300 Subject: Better solution to luaL_checkint... --- src/luasocket.c | 7 +------ src/mime.c | 7 +------ 2 files changed, 2 insertions(+), 12 deletions(-) diff --git a/src/luasocket.c b/src/luasocket.c index 40731f1..c4eeab3 100644 --- a/src/luasocket.c +++ b/src/luasocket.c @@ -31,11 +31,6 @@ #include "udp.h" #include "select.h" -#if LUA_VERSION_NUM > 502 && !defined(LUA_COMPAT_APIINTCASTS) -#define luaL_checkint(L,n) ((int)luaL_checkinteger(L, (n))) -#define luaL_optint(L,n,d) ((int)luaL_optinteger(L, (n), (d))) -#endif - /*-------------------------------------------------------------------------*\ * Internal function prototypes \*-------------------------------------------------------------------------*/ @@ -68,7 +63,7 @@ static luaL_Reg func[] = { * Skip a few arguments \*-------------------------------------------------------------------------*/ static int global_skip(lua_State *L) { - int amount = luaL_checkint(L, 1); + int amount = luaL_checkinteger(L, 1); int ret = lua_gettop(L) - amount - 1; return ret >= 0 ? ret : 0; } diff --git a/src/mime.c b/src/mime.c index fdd1477..8edb750 100644 --- a/src/mime.c +++ b/src/mime.c @@ -13,11 +13,6 @@ #include "mime.h" -#if LUA_VERSION_NUM > 502 && !defined(LUA_COMPAT_APIINTCASTS) -#define luaL_checkint(L,n) ((int)luaL_checkinteger(L, (n))) -#define luaL_optint(L,n,d) ((int)luaL_optinteger(L, (n), (d))) -#endif - /*=========================================================================*\ * Don't want to trust escape character constants \*=========================================================================*/ @@ -666,7 +661,7 @@ static int eolprocess(int c, int last, const char *marker, \*-------------------------------------------------------------------------*/ static int mime_global_eol(lua_State *L) { - int ctx = luaL_checkint(L, 1); + int ctx = luaL_checkinteger(L, 1); size_t isize = 0; const char *input = luaL_optlstring(L, 2, NULL, &isize); const char *last = input + isize; -- cgit v1.2.3-55-g6feb