lua/lmem.h File Reference

#include <stddef.h>
#include "llimits.h"
#include "lua.h"

Go to the source code of this file.

Defines

#define MEMERRMSG   "not enough memory"
#define luaM_free(L, b, s)   luaM_realloc(L, (b), (s), 0)
#define luaM_freelem(L, b)   luaM_realloc(L, (b), sizeof(*(b)), 0)
#define luaM_freearray(L, b, n, t)
#define luaM_malloc(L, t)   luaM_realloc(L, NULL, 0, (t))
#define luaM_new(L, t)   cast(t *, luaM_malloc(L, sizeof(t)))
#define luaM_newvector(L, n, t)
#define luaM_growvector(L, v, nelems, size, t, limit, e)
#define luaM_reallocvector(L, v, oldn, n, t)

Functions

void * luaM_realloc (lua_State *L, void *oldblock, lu_mem oldsize, lu_mem size)
void * luaM_growaux (lua_State *L, void *block, int *size, int size_elem, int limit, const char *errormsg)


Define Documentation

#define luaM_free ( L,
b,
 )     luaM_realloc(L, (b), (s), 0)

Definition at line 28 of file lmem.h.

Referenced by freeobj(), freestate(), and luaF_freeclosure().

#define luaM_freearray ( L,
b,
n,
 ) 

Value:

luaM_realloc(L, (b), \
                                      cast(lu_mem, n)*cast(lu_mem, sizeof(t)), 0)

Definition at line 30 of file lmem.h.

Referenced by freestack(), luaF_freeproto(), luaH_free(), luaS_freeall(), luaS_resize(), and resize().

#define luaM_freelem ( L,
 )     luaM_realloc(L, (b), sizeof(*(b)), 0)

Definition at line 29 of file lmem.h.

Referenced by close_state(), freeobj(), luaF_freeproto(), and luaH_free().

#define luaM_growvector ( L,
v,
nelems,
size,
t,
limit,
 ) 

Value:

if (((nelems)+1) > (size)) \
            ((v)=cast(t *, luaM_growaux(L,v,&(size),sizeof(t),limit,e)))

Definition at line 38 of file lmem.h.

Referenced by addk(), luaI_registerlocalvar(), luaK_code(), and pushclosure().

#define luaM_malloc ( L,
 )     luaM_realloc(L, NULL, 0, (t))

Definition at line 33 of file lmem.h.

Referenced by luaF_newCclosure(), luaF_newLclosure(), luaS_newudata(), mallocstate(), and newlstr().

#define luaM_new ( L,
 )     cast(t *, luaM_malloc(L, sizeof(t)))

Definition at line 34 of file lmem.h.

Referenced by f_luaopen(), luaF_findupval(), luaF_newproto(), and luaH_new().

#define luaM_newvector ( L,
n,
 ) 

Value:

cast(t *, luaM_malloc(L, \
                                         cast(lu_mem, n)*cast(lu_mem, sizeof(t))))

Definition at line 35 of file lmem.h.

Referenced by LoadCode(), LoadConstants(), LoadLines(), LoadLocals(), LoadUpvalues(), luaS_resize(), setnodevector(), and stack_init().

#define luaM_reallocvector ( L,
v,
oldn,
n,
 ) 

Value:

((v)=cast(t *, luaM_realloc(L, v,cast(lu_mem, oldn)*cast(lu_mem, sizeof(t)), \
                                    cast(lu_mem, n)*cast(lu_mem, sizeof(t)))))

Definition at line 42 of file lmem.h.

Referenced by close_func(), luaD_reallocCI(), luaD_reallocstack(), luaZ_openspace(), resize(), and setarrayvector().

#define MEMERRMSG   "not enough memory"

Definition at line 16 of file lmem.h.

Referenced by f_luaopen(), and seterrorobj().


Function Documentation

void* luaM_growaux ( lua_State L,
void *  block,
int *  size,
int  size_elem,
int  limit,
const char *  errormsg 
)

Definition at line 43 of file lmem.c.

References cast, luaG_runerror(), luaM_realloc(), and MINSIZEARRAY.

void* luaM_realloc ( lua_State L,
void *  oldblock,
lu_mem  oldsize,
lu_mem  size 
)

Definition at line 65 of file lmem.c.

References G, l_free, l_realloc, lua_assert, luaD_throw(), luaG_runerror(), and MAX_SIZET.

Referenced by luaM_growaux().


Generated on Fri Oct 12 08:44:55 2007 for rpm by  doxygen 1.5.2