mirror of https://github.com/rusefi/lua.git
new function `lua_getallocf' to retrieve allocation function and data
This commit is contained in:
parent
8502331f69
commit
03bab90303
10
lapi.c
10
lapi.c
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
** $Id: lapi.c,v 1.246 2003/10/10 12:57:55 roberto Exp roberto $
|
||||
** $Id: lapi.c,v 1.247 2003/10/10 13:29:08 roberto Exp roberto $
|
||||
** Lua API
|
||||
** See Copyright Notice in lua.h
|
||||
*/
|
||||
|
@ -882,6 +882,12 @@ LUA_API void lua_concat (lua_State *L, int n) {
|
|||
}
|
||||
|
||||
|
||||
LUA_API lua_Alloc lua_getallocf (lua_State *L, void **ud) {
|
||||
*ud = G(L)->ud;
|
||||
return G(L)->realloc;
|
||||
}
|
||||
|
||||
|
||||
LUA_API void *lua_newuserdata (lua_State *L, size_t size) {
|
||||
Udata *u;
|
||||
lua_lock(L);
|
||||
|
@ -894,6 +900,8 @@ LUA_API void *lua_newuserdata (lua_State *L, size_t size) {
|
|||
}
|
||||
|
||||
|
||||
|
||||
|
||||
static const char *aux_upvalue (lua_State *L, int funcindex, int n,
|
||||
TObject **val) {
|
||||
Closure *f;
|
||||
|
|
5
ltests.c
5
ltests.c
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
** $Id: ltests.c,v 1.165 2003/10/07 20:13:41 roberto Exp roberto $
|
||||
** $Id: ltests.c,v 1.166 2003/10/10 13:29:08 roberto Exp roberto $
|
||||
** Internal Module for Debugging of the Lua Implementation
|
||||
** See Copyright Notice in lua.h
|
||||
*/
|
||||
|
@ -836,6 +836,9 @@ static int l_panic (lua_State *L) {
|
|||
|
||||
|
||||
int luaB_opentests (lua_State *L) {
|
||||
void *ud;
|
||||
lua_assert(lua_getallocf(L, &ud) == debug_realloc);
|
||||
lua_assert(ud == cast(void *, &memcontrol));
|
||||
lua_atpanic(L, l_panic);
|
||||
lua_userstateopen(L); /* init lock */
|
||||
lua_state = L; /* keep first state to be opened */
|
||||
|
|
4
lua.h
4
lua.h
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
** $Id: lua.h,v 1.181 2003/10/10 12:57:55 roberto Exp roberto $
|
||||
** $Id: lua.h,v 1.182 2003/10/10 13:29:08 roberto Exp roberto $
|
||||
** Lua - An Extensible Extension Language
|
||||
** Tecgraf: Computer Graphics Technology Group, PUC-Rio, Brazil
|
||||
** http://www.lua.org mailto:info@lua.org
|
||||
|
@ -239,6 +239,8 @@ LUA_API int lua_next (lua_State *L, int idx);
|
|||
|
||||
LUA_API void lua_concat (lua_State *L, int n);
|
||||
|
||||
LUA_API lua_Alloc lua_getallocf (lua_State *L, void **ud);
|
||||
|
||||
|
||||
|
||||
/*
|
||||
|
|
Loading…
Reference in New Issue