MCPcopy Create free account
hub / github.com/F-Stack/f-stack / lua_checkstack

Function lua_checkstack

freebsd/contrib/openzfs/module/lua/lapi.c:89–106  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

87
88
89LUA_API int lua_checkstack (lua_State *L, int size) {
90 int res;
91 CallInfo *ci = L->ci;
92 lua_lock(L);
93 if (L->stack_last - L->top > size) /* stack large enough? */
94 res = 1; /* yes; check is OK */
95 else { /* no; need to grow stack */
96 int inuse = cast_int(L->top - L->stack) + EXTRA_STACK;
97 if (inuse > LUAI_MAXSTACK - size) /* can grow without overflow? */
98 res = 0; /* no */
99 else /* try to grow stack */
100 res = (luaD_rawrunprotected(L, &growstack, &size) == LUA_OK);
101 }
102 if (res && ci->top < L->top + size)
103 ci->top = L->top + size; /* adjust frame top */
104 lua_unlock(L);
105 return res;
106}
107
108
109LUA_API void lua_xmove (lua_State *from, lua_State *to, int n) {

Callers 4

luaL_checkstackFunction · 0.70
auxresumeFunction · 0.70
unpackFunction · 0.70
zcp_lua_to_nvlist_implFunction · 0.50

Calls 1

luaD_rawrunprotectedFunction · 0.70

Tested by

no test coverage detected