mirror of
https://github.com/luau-lang/luau.git
synced 2025-05-04 10:33:46 +01:00
Remove lua_setallocf
as it's unsafe
This commit is contained in:
parent
efdbaae976
commit
f94276736f
3 changed files with 0 additions and 17 deletions
|
@ -324,7 +324,6 @@ LUA_API void lua_clonefunction(lua_State* L, int idx);
|
|||
LUA_API void lua_cleartable(lua_State* L, int idx);
|
||||
|
||||
LUA_API lua_Alloc lua_getallocf(lua_State* L, void** ud);
|
||||
LUA_API void lua_setallocf(lua_State* L, lua_Alloc f, void* ud);
|
||||
|
||||
/*
|
||||
** reference system, can be used to pin objects
|
||||
|
|
|
@ -1440,9 +1440,3 @@ lua_Alloc lua_getallocf(lua_State* L, void** ud)
|
|||
*ud = L->global->ud;
|
||||
return f;
|
||||
}
|
||||
|
||||
void lua_setallocf(lua_State* L, lua_Alloc f, void* ud)
|
||||
{
|
||||
L->global->frealloc = f;
|
||||
L->global->ud = ud;
|
||||
}
|
||||
|
|
|
@ -1173,16 +1173,6 @@ TEST_CASE("AllocApi")
|
|||
bool allocfIsSet = lua_getallocf(L, &ud_check) == limitedRealloc;
|
||||
CHECK(allocfIsSet);
|
||||
CHECK(ud_check == &ud);
|
||||
|
||||
auto limitedReallocAlt = [](void* ud, void* ptr, size_t osize, size_t nsize) -> void* {
|
||||
return limitedRealloc(ud, ptr, osize, nsize);
|
||||
};
|
||||
|
||||
int ud2 = 0;
|
||||
lua_setallocf(L, limitedReallocAlt, &ud2);
|
||||
allocfIsSet = lua_getallocf(L, &ud_check) == limitedReallocAlt;
|
||||
CHECK(allocfIsSet);
|
||||
CHECK(ud_check == &ud2);
|
||||
}
|
||||
|
||||
#if !LUA_USE_LONGJMP
|
||||
|
|
Loading…
Add table
Reference in a new issue