diff options
Diffstat (limited to 'lmem.h')
-rw-r--r-- | lmem.h | 28 |
1 files changed, 14 insertions, 14 deletions
@@ -1,5 +1,5 @@ | |||
1 | /* | 1 | /* |
2 | ** $Id: lmem.h,v 1.12 2000/01/13 16:30:47 roberto Exp roberto $ | 2 | ** $Id: lmem.h,v 1.13 2000/03/16 20:35:07 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 | */ |
@@ -8,29 +8,29 @@ | |||
8 | #define lmem_h | 8 | #define lmem_h |
9 | 9 | ||
10 | 10 | ||
11 | #include <stdlib.h> | 11 | #include <stddef.h> |
12 | 12 | ||
13 | #include "llimits.h" | ||
13 | #include "lua.h" | 14 | #include "lua.h" |
14 | 15 | ||
15 | /* memory error messages */ | 16 | /* memory error message */ |
16 | #define codeEM "code size overflow" | ||
17 | #define constantEM "constant table overflow" | ||
18 | #define refEM "reference table overflow" | ||
19 | #define tableEM "table overflow" | ||
20 | #define memEM "not enough memory" | 17 | #define memEM "not enough memory" |
21 | #define arrEM "internal array larger than `int' limit" | ||
22 | 18 | ||
23 | void *luaM_realloc (lua_State *L, void *oldblock, unsigned long size); | 19 | void *luaM_realloc (lua_State *L, void *oldblock, lint32 size); |
24 | void *luaM_growaux (lua_State *L, void *block, unsigned long nelems, int inc, int size, | 20 | void *luaM_growaux (lua_State *L, void *block, size_t nelems, |
25 | const char *errormsg, unsigned long limit); | 21 | int inc, size_t size, const char *errormsg, |
22 | size_t limit); | ||
26 | 23 | ||
27 | #define luaM_free(L, b) luaM_realloc(L, (b), 0) | 24 | #define luaM_free(L, b) luaM_realloc(L, (b), 0) |
28 | #define luaM_malloc(L, t) luaM_realloc(L, NULL, (t)) | 25 | #define luaM_malloc(L, t) luaM_realloc(L, NULL, (t)) |
29 | #define luaM_new(L, t) ((t *)luaM_malloc(L, sizeof(t))) | 26 | #define luaM_new(L, t) ((t *)luaM_malloc(L, sizeof(t))) |
30 | #define luaM_newvector(L, n,t) ((t *)luaM_malloc(L, (n)*sizeof(t))) | 27 | #define luaM_newvector(L, n,t) ((t *)luaM_malloc(L, (n)*(lint32)sizeof(t))) |
28 | |||
31 | #define luaM_growvector(L, v,nelems,inc,t,e,l) \ | 29 | #define luaM_growvector(L, v,nelems,inc,t,e,l) \ |
32 | ((v)=(t *)luaM_growaux(L, v,nelems,inc,sizeof(t),e,l)) | 30 | ((v)=(t *)luaM_growaux(L, v,nelems,inc,sizeof(t),e,l)) |
33 | #define luaM_reallocvector(L, v,n,t) ((v)=(t *)luaM_realloc(L, v,(n)*sizeof(t))) | 31 | |
32 | #define luaM_reallocvector(L, v,n,t) \ | ||
33 | ((v)=(t *)luaM_realloc(L, v,(n)*(lint32)sizeof(t))) | ||
34 | 34 | ||
35 | 35 | ||
36 | #ifdef DEBUG | 36 | #ifdef DEBUG |