diff options
author | Roberto Ierusalimschy <roberto@inf.puc-rio.br> | 1999-02-25 12:16:26 -0300 |
---|---|---|
committer | Roberto Ierusalimschy <roberto@inf.puc-rio.br> | 1999-02-25 12:16:26 -0300 |
commit | 26d1e21c89a481c2368ba934da8e192a164d8f99 (patch) | |
tree | ea2eaaade79264b71d0e18fef75bca70fc1f4766 /lmem.h | |
parent | 24a2c08145ecc9b5c528a46ba83bdd7b95dbdc02 (diff) | |
download | lua-26d1e21c89a481c2368ba934da8e192a164d8f99.tar.gz lua-26d1e21c89a481c2368ba934da8e192a164d8f99.tar.bz2 lua-26d1e21c89a481c2368ba934da8e192a164d8f99.zip |
new way to handle "growing" vectors
Diffstat (limited to 'lmem.h')
-rw-r--r-- | lmem.h | 8 |
1 files changed, 4 insertions, 4 deletions
@@ -1,5 +1,5 @@ | |||
1 | /* | 1 | /* |
2 | ** $Id: lmem.h,v 1.5 1997/12/17 20:48:58 roberto Exp roberto $ | 2 | ** $Id: lmem.h,v 1.6 1998/12/15 14:59:43 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 | */ |
@@ -18,15 +18,15 @@ | |||
18 | #define memEM "not enough memory" | 18 | #define memEM "not enough memory" |
19 | 19 | ||
20 | void *luaM_realloc (void *oldblock, unsigned long size); | 20 | void *luaM_realloc (void *oldblock, unsigned long size); |
21 | int luaM_growaux (void **block, unsigned long nelems, int size, | 21 | void *luaM_growaux (void *block, unsigned long nelems, int inc, int size, |
22 | char *errormsg, unsigned long limit); | 22 | char *errormsg, unsigned long limit); |
23 | 23 | ||
24 | #define luaM_free(b) luaM_realloc((b), 0) | 24 | #define luaM_free(b) luaM_realloc((b), 0) |
25 | #define luaM_malloc(t) luaM_realloc(NULL, (t)) | 25 | #define luaM_malloc(t) luaM_realloc(NULL, (t)) |
26 | #define luaM_new(t) ((t *)luaM_malloc(sizeof(t))) | 26 | #define luaM_new(t) ((t *)luaM_malloc(sizeof(t))) |
27 | #define luaM_newvector(n,t) ((t *)luaM_malloc((n)*sizeof(t))) | 27 | #define luaM_newvector(n,t) ((t *)luaM_malloc((n)*sizeof(t))) |
28 | #define luaM_growvector(old,n,t,e,l) \ | 28 | #define luaM_growvector(old,nelems,inc,t,e,l) \ |
29 | (luaM_growaux((void**)old,n,sizeof(t),e,l)) | 29 | ((t *)luaM_growaux(old,nelems,inc,sizeof(t),e,l)) |
30 | #define luaM_reallocvector(v,n,t) ((t *)luaM_realloc(v,(n)*sizeof(t))) | 30 | #define luaM_reallocvector(v,n,t) ((t *)luaM_realloc(v,(n)*sizeof(t))) |
31 | 31 | ||
32 | 32 | ||