'luaL_newstate' should not allocate extra memory

The allocation of a userdata for the state of the warn system can
cause a panic if it fails; 'luaL_ref' also can fail. This commit
re-implements the warn system so that it does not need an explicit
state. Instead, the system uses different functions to represent
the different states.
This commit is contained in:
Roberto Ierusalimschy
2020-11-03 16:34:36 -03:00
parent 94cbe46511
commit 58216600eb
3 changed files with 50 additions and 26 deletions

View File

@@ -863,7 +863,7 @@ static int alloc_failnext (lua_State *L) {
l_memcontrol.failnext = 1;
return 0;
}
static int settrick (lua_State *L) {
if (ttisnil(obj_at(L, 1)))