AP_Scripting: remove unused user of realloc from lua

This commit is contained in:
bugobliterator 2020-03-19 07:25:30 +05:30 committed by Andrew Tridgell
parent 8215537f99
commit edaf9fa086
1 changed files with 19 additions and 19 deletions

View File

@ -1005,29 +1005,29 @@ 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 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 */
}
// 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 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) {