aboutsummaryrefslogtreecommitdiff
path: root/lapi.c
diff options
context:
space:
mode:
authorRoberto Ierusalimschy <roberto@inf.puc-rio.br>2005-09-20 14:55:10 -0300
committerRoberto Ierusalimschy <roberto@inf.puc-rio.br>2005-09-20 14:55:10 -0300
commitd8f1cca16ea9a682127bb328c8bdfbfb4ded3412 (patch)
treea43ca86e36a0d27ccda6c4599988cc2c69b50e34 /lapi.c
parentbf96d3fdd9ee477faa774734453c27535a36b16f (diff)
downloadlua-d8f1cca16ea9a682127bb328c8bdfbfb4ded3412.tar.gz
lua-d8f1cca16ea9a682127bb328c8bdfbfb4ded3412.tar.bz2
lua-d8f1cca16ea9a682127bb328c8bdfbfb4ded3412.zip
new function 'lua_setallocf'
Diffstat (limited to 'lapi.c')
-rw-r--r--lapi.c16
1 files changed, 14 insertions, 2 deletions
diff --git a/lapi.c b/lapi.c
index 65711ca0..16f469da 100644
--- a/lapi.c
+++ b/lapi.c
@@ -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
994LUA_API lua_Alloc lua_getallocf (lua_State *L, void **ud) { 994LUA_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
1004LUA_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