aboutsummaryrefslogtreecommitdiff
path: root/src/luasocket.c
diff options
context:
space:
mode:
authorDiego Nehab <diego@impa.br>2015-03-01 22:49:04 -0300
committerDiego Nehab <diego@impa.br>2015-03-01 22:49:04 -0300
commit8396a0291b2d97bc837c4c55bb99f7f6777ce515 (patch)
tree3e65b498ff30b00b32819037e4bfa2719286e9c7 /src/luasocket.c
parent9d49cdcf05d49a99d9095d63318f11adc73c10d0 (diff)
downloadluasocket-8396a0291b2d97bc837c4c55bb99f7f6777ce515.tar.gz
luasocket-8396a0291b2d97bc837c4c55bb99f7f6777ce515.tar.bz2
luasocket-8396a0291b2d97bc837c4c55bb99f7f6777ce515.zip
Better solution to luaL_checkint...
Diffstat (limited to 'src/luasocket.c')
-rw-r--r--src/luasocket.c7
1 files changed, 1 insertions, 6 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 @@
31#include "udp.h" 31#include "udp.h"
32#include "select.h" 32#include "select.h"
33 33
34#if LUA_VERSION_NUM > 502 && !defined(LUA_COMPAT_APIINTCASTS)
35#define luaL_checkint(L,n) ((int)luaL_checkinteger(L, (n)))
36#define luaL_optint(L,n,d) ((int)luaL_optinteger(L, (n), (d)))
37#endif
38
39/*-------------------------------------------------------------------------*\ 34/*-------------------------------------------------------------------------*\
40* Internal function prototypes 35* Internal function prototypes
41\*-------------------------------------------------------------------------*/ 36\*-------------------------------------------------------------------------*/
@@ -68,7 +63,7 @@ static luaL_Reg func[] = {
68* Skip a few arguments 63* Skip a few arguments
69\*-------------------------------------------------------------------------*/ 64\*-------------------------------------------------------------------------*/
70static int global_skip(lua_State *L) { 65static int global_skip(lua_State *L) {
71 int amount = luaL_checkint(L, 1); 66 int amount = luaL_checkinteger(L, 1);
72 int ret = lua_gettop(L) - amount - 1; 67 int ret = lua_gettop(L) - amount - 1;
73 return ret >= 0 ? ret : 0; 68 return ret >= 0 ? ret : 0;
74} 69}