Imported from ../lua-3.2.tar.gz.
[lua.git] / src / lmem.h
blob967899c919eedc7ae64a768fff9199bff1eacb1a
1 /*
2 ** $Id: lmem.h,v 1.8 1999/02/26 15:48:55 roberto Exp $
3 ** Interface to Memory Manager
4 ** See Copyright Notice in lua.h
5 */
7 #ifndef lmem_h
8 #define lmem_h
11 #include <stdlib.h>
13 /* memory error messages */
14 #define codeEM "code size overflow"
15 #define constantEM "constant table overflow"
16 #define refEM "reference table overflow"
17 #define tableEM "table overflow"
18 #define memEM "not enough memory"
19 #define arrEM "internal array bigger than `int' limit"
21 void *luaM_realloc (void *oldblock, unsigned long size);
22 void *luaM_growaux (void *block, unsigned long nelems, int inc, int size,
23 char *errormsg, unsigned long limit);
25 #define luaM_free(b) luaM_realloc((b), 0)
26 #define luaM_malloc(t) luaM_realloc(NULL, (t))
27 #define luaM_new(t) ((t *)luaM_malloc(sizeof(t)))
28 #define luaM_newvector(n,t) ((t *)luaM_malloc((n)*sizeof(t)))
29 #define luaM_growvector(v,nelems,inc,t,e,l) \
30 ((v)=(t *)luaM_growaux(v,nelems,inc,sizeof(t),e,l))
31 #define luaM_reallocvector(v,n,t) ((v)=(t *)luaM_realloc(v,(n)*sizeof(t)))
34 #ifdef DEBUG
35 extern unsigned long numblocks;
36 extern unsigned long totalmem;
37 #endif
40 #endif