mirror of
https://github.com/lunarmodules/luasocket.git
synced 2024-12-25 20:18:21 +01:00
Better solution to luaL_checkint...
This commit is contained in:
parent
9d49cdcf05
commit
8396a0291b
@ -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;
|
||||
}
|
||||
|
@ -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;
|
||||
|
Loading…
Reference in New Issue
Block a user