lua/luamem.h

35 lines
847 B
C
Raw Normal View History

1994-11-16 09:39:16 -08:00
/*
** mem.c
** memory manager for lua
1996-03-21 08:33:47 -08:00
** $Id: mem.h,v 1.4 1996/03/14 15:55:49 roberto Exp roberto $
1994-11-16 09:39:16 -08:00
*/
#ifndef mem_h
#define mem_h
#ifndef NULL
#define NULL 0
#endif
1996-03-21 08:33:47 -08:00
/* memory error messages */
#define NUMERRMSG 6
enum memerrormsg {codeEM, symbolEM, constantEM, stackEM, lexEM, lockEM};
extern char *luaI_memerrormsg[];
1994-11-16 09:39:16 -08:00
void luaI_free (void *block);
void *luaI_malloc (unsigned long size);
void *luaI_realloc (void *oldblock, unsigned long size);
1996-03-21 08:33:47 -08:00
void *luaI_buffer (unsigned long size);
int luaI_growvector (void **block, unsigned long nelems, int size,
enum memerrormsg errormsg, unsigned long limit);
1994-11-16 09:39:16 -08:00
#define new(s) ((s *)luaI_malloc(sizeof(s)))
#define newvector(n,s) ((s *)luaI_malloc((n)*sizeof(s)))
1996-03-21 08:33:47 -08:00
#define growvector(old,n,s,e,l) \
(luaI_growvector((void**)old,n,sizeof(s),e,l))
1994-11-16 09:39:16 -08:00
#endif