Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

source: code/branches/ceguilua/src/lua-5.0.3/lua/lmem.h @ 1808

Last change on this file since 1808 was 1803, checked in by rgrieder, 16 years ago

added files for lua 5.1.3, lua 5.0.3, CEGUILua-0.6.1 and CEGUILua-0.5.0b

  • Property svn:eol-style set to native
File size: 1.3 KB
Line 
1/*
2** $Id: lmem.h,v 1.26 2002/05/01 20:40:42 roberto Exp $
3** Interface to Memory Manager
4** See Copyright Notice in lua.h
5*/
6
7#ifndef lmem_h
8#define lmem_h
9
10
11#include <stddef.h>
12
13#include "llimits.h"
14#include "lua.h"
15
16#define MEMERRMSG       "not enough memory"
17
18
19void *luaM_realloc (lua_State *L, void *oldblock, lu_mem oldsize, lu_mem size);
20
21void *luaM_growaux (lua_State *L, void *block, int *size, int size_elem,
22                    int limit, const char *errormsg);
23
24#define luaM_free(L, b, s)      luaM_realloc(L, (b), (s), 0)
25#define luaM_freelem(L, b)      luaM_realloc(L, (b), sizeof(*(b)), 0)
26#define luaM_freearray(L, b, n, t)      luaM_realloc(L, (b), \
27                                      cast(lu_mem, n)*cast(lu_mem, sizeof(t)), 0)
28
29#define luaM_malloc(L, t)       luaM_realloc(L, NULL, 0, (t))
30#define luaM_new(L, t)          cast(t *, luaM_malloc(L, sizeof(t)))
31#define luaM_newvector(L, n,t)  cast(t *, luaM_malloc(L, \
32                                         cast(lu_mem, n)*cast(lu_mem, sizeof(t))))
33
34#define luaM_growvector(L,v,nelems,size,t,limit,e) \
35          if (((nelems)+1) > (size)) \
36            ((v)=cast(t *, luaM_growaux(L,v,&(size),sizeof(t),limit,e)))
37
38#define luaM_reallocvector(L, v,oldn,n,t) \
39   ((v)=cast(t *, luaM_realloc(L, v,cast(lu_mem, oldn)*cast(lu_mem, sizeof(t)), \
40                                    cast(lu_mem, n)*cast(lu_mem, sizeof(t)))))
41
42
43#endif
44
Note: See TracBrowser for help on using the repository browser.