diff options
Diffstat (limited to 'lapi.c')
-rw-r--r-- | lapi.c | 16 |
1 files changed, 14 insertions, 2 deletions
@@ -1,5 +1,5 @@ | |||
1 | /* | 1 | /* |
2 | ** $Id: lapi.c,v 2.48 2005/09/01 17:42:22 roberto Exp roberto $ | 2 | ** $Id: lapi.c,v 2.49 2005/09/14 17:44:48 roberto Exp roberto $ |
3 | ** Lua API | 3 | ** Lua API |
4 | ** See Copyright Notice in lua.h | 4 | ** See Copyright Notice in lua.h |
5 | */ | 5 | */ |
@@ -992,8 +992,20 @@ LUA_API void lua_concat (lua_State *L, int n) { | |||
992 | 992 | ||
993 | 993 | ||
994 | LUA_API lua_Alloc lua_getallocf (lua_State *L, void **ud) { | 994 | LUA_API lua_Alloc lua_getallocf (lua_State *L, void **ud) { |
995 | lua_Alloc f; | ||
996 | lua_lock(L); | ||
995 | if (ud) *ud = G(L)->ud; | 997 | if (ud) *ud = G(L)->ud; |
996 | return G(L)->frealloc; | 998 | f = G(L)->frealloc; |
999 | lua_unlock(L); | ||
1000 | return f; | ||
1001 | } | ||
1002 | |||
1003 | |||
1004 | LUA_API void lua_setallocf (lua_State *L, lua_Alloc f, void *ud) { | ||
1005 | lua_lock(L); | ||
1006 | G(L)->ud = ud; | ||
1007 | G(L)->frealloc = f; | ||
1008 | lua_unlock(L); | ||
997 | } | 1009 | } |
998 | 1010 | ||
999 | 1011 | ||