diff options
author | Roberto Ierusalimschy <roberto@inf.puc-rio.br> | 2009-12-17 13:46:44 -0200 |
---|---|---|
committer | Roberto Ierusalimschy <roberto@inf.puc-rio.br> | 2009-12-17 13:46:44 -0200 |
commit | 0bbdddc86b1353fec36ae886b4142986f3c4713f (patch) | |
tree | 9eb933c8123911f9477e8b8b55344035c8077c01 /lmem.h | |
parent | b3b8dfaaea2dba7e7b4b898a5f767a80f36319f1 (diff) | |
download | lua-0bbdddc86b1353fec36ae886b4142986f3c4713f.tar.gz lua-0bbdddc86b1353fec36ae886b4142986f3c4713f.tar.bz2 lua-0bbdddc86b1353fec36ae886b4142986f3c4713f.zip |
allocator function receives the tag of object being allocated in 'osize'
when 'ptr' is NULL.
Diffstat (limited to 'lmem.h')
-rw-r--r-- | lmem.h | 6 |
1 files changed, 4 insertions, 2 deletions
@@ -1,5 +1,5 @@ | |||
1 | /* | 1 | /* |
2 | ** $Id: lmem.h,v 1.33 2007/02/09 13:04:52 roberto Exp roberto $ | 2 | ** $Id: lmem.h,v 1.34 2009/04/17 14:40:13 roberto Exp roberto $ |
3 | ** Interface to Memory Manager | 3 | ** Interface to Memory Manager |
4 | ** See Copyright Notice in lua.h | 4 | ** See Copyright Notice in lua.h |
5 | */ | 5 | */ |
@@ -25,11 +25,13 @@ | |||
25 | #define luaM_free(L, b) luaM_realloc_(L, (b), sizeof(*(b)), 0) | 25 | #define luaM_free(L, b) luaM_realloc_(L, (b), sizeof(*(b)), 0) |
26 | #define luaM_freearray(L, b, n) luaM_reallocv(L, (b), n, 0, sizeof((b)[0])) | 26 | #define luaM_freearray(L, b, n) luaM_reallocv(L, (b), n, 0, sizeof((b)[0])) |
27 | 27 | ||
28 | #define luaM_malloc(L,t) luaM_realloc_(L, NULL, 0, (t)) | 28 | #define luaM_malloc(L,s) luaM_realloc_(L, NULL, 0, (s)) |
29 | #define luaM_new(L,t) cast(t *, luaM_malloc(L, sizeof(t))) | 29 | #define luaM_new(L,t) cast(t *, luaM_malloc(L, sizeof(t))) |
30 | #define luaM_newvector(L,n,t) \ | 30 | #define luaM_newvector(L,n,t) \ |
31 | cast(t *, luaM_reallocv(L, NULL, 0, n, sizeof(t))) | 31 | cast(t *, luaM_reallocv(L, NULL, 0, n, sizeof(t))) |
32 | 32 | ||
33 | #define luaM_newobject(L,tag,s) luaM_realloc_(L, NULL, tag, (s)) | ||
34 | |||
33 | #define luaM_growvector(L,v,nelems,size,t,limit,e) \ | 35 | #define luaM_growvector(L,v,nelems,size,t,limit,e) \ |
34 | if ((nelems)+1 > (size)) \ | 36 | if ((nelems)+1 > (size)) \ |
35 | ((v)=cast(t *, luaM_growaux_(L,v,&(size),sizeof(t),limit,e))) | 37 | ((v)=cast(t *, luaM_growaux_(L,v,&(size),sizeof(t),limit,e))) |