From bf2559f44dcda7b50871a6f8093b032ccc744226 Mon Sep 17 00:00:00 2001 From: Juan Carrano Date: Tue, 24 Apr 2018 16:38:37 +0200 Subject: [PATCH 1/7] Remove luaL_newstate. --- lauxlib.c | 25 ------------------------- lauxlib.h | 2 -- 2 files changed, 27 deletions(-) diff --git a/lauxlib.c b/lauxlib.c index 7b14ca4d..018a4347 100644 --- a/lauxlib.c +++ b/lauxlib.c @@ -1005,31 +1005,6 @@ LUALIB_API const char *luaL_gsub (lua_State *L, const char *s, const char *p, } -static void *l_alloc (void *ud, void *ptr, size_t osize, size_t nsize) { - (void)ud; (void)osize; /* not used */ - if (nsize == 0) { - free(ptr); - return NULL; - } - else - return realloc(ptr, nsize); -} - - -static int panic (lua_State *L) { - lua_writestringerror("PANIC: unprotected error in call to Lua API (%s)\n", - lua_tostring(L, -1)); - return 0; /* return to Lua to abort */ -} - - -LUALIB_API lua_State *luaL_newstate (void) { - lua_State *L = lua_newstate(l_alloc, NULL); - if (L) lua_atpanic(L, &panic); - return L; -} - - LUALIB_API void luaL_checkversion_ (lua_State *L, lua_Number ver, size_t sz) { const lua_Number *v = lua_version(L); if (sz != LUAL_NUMSIZES) /* check numeric types */ diff --git a/lauxlib.h b/lauxlib.h index 1d65c975..77d1494d 100644 --- a/lauxlib.h +++ b/lauxlib.h @@ -89,8 +89,6 @@ LUALIB_API int (luaL_loadbufferx) (lua_State *L, const char *buff, size_t sz, const char *name, const char *mode); LUALIB_API int (luaL_loadstring) (lua_State *L, const char *s); -LUALIB_API lua_State *(luaL_newstate) (void); - LUALIB_API lua_Integer (luaL_len) (lua_State *L, int idx); LUALIB_API const char *(luaL_gsub) (lua_State *L, const char *s, const char *p, -- 2.25.1