The Battle for Wesnoth  1.13.4+dev
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Modules Pages
Macros | Functions
lmem.h File Reference
#include <stddef.h>
#include "llimits.h"
#include "lua.h"
Include dependency graph for lmem.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Macros

#define luaM_reallocv(L, b, on, n, e)
 
#define luaM_freemem(L, b, s)   luaM_realloc_(L, (b), (s), 0)
 
#define luaM_free(L, b)   luaM_realloc_(L, (b), sizeof(*(b)), 0)
 
#define luaM_freearray(L, b, n)   luaM_reallocv(L, (b), n, 0, sizeof((b)[0]))
 
#define luaM_malloc(L, s)   luaM_realloc_(L, NULL, 0, (s))
 
#define luaM_new(L, t)   cast(t *, luaM_malloc(L, sizeof(t)))
 
#define luaM_newvector(L, n, t)   cast(t *, luaM_reallocv(L, NULL, 0, n, sizeof(t)))
 
#define luaM_newobject(L, tag, s)   luaM_realloc_(L, NULL, tag, (s))
 
#define luaM_growvector(L, v, nelems, size, t, limit, e)
 
#define luaM_reallocvector(L, v, oldn, n, t)   ((v)=cast(t *, luaM_reallocv(L, v, oldn, n, sizeof(t))))
 

Functions

LUAI_FUNC l_noret luaM_toobig (lua_State *L)
 
LUAI_FUNC voidluaM_realloc_ (lua_State *L, void *block, size_t oldsize, size_t size)
 
LUAI_FUNC voidluaM_growaux_ (lua_State *L, void *block, int *size, size_t size_elem, int limit, const char *what)
 

Macro Definition Documentation

#define luaM_free (   L,
  b 
)    luaM_realloc_(L, (b), sizeof(*(b)), 0)

Definition at line 29 of file lmem.h.

Referenced by luaE_freeCI(), luaE_freethread(), luaF_freeproto(), luaF_freeupval(), and luaH_free().

#define luaM_freearray (   L,
  b,
  n 
)    luaM_reallocv(L, (b), n, 0, sizeof((b)[0]))
#define luaM_freemem (   L,
  b,
  s 
)    luaM_realloc_(L, (b), (s), 0)

Definition at line 28 of file lmem.h.

Referenced by freeobj().

#define luaM_growvector (   L,
  v,
  nelems,
  size,
  t,
  limit,
  e 
)
Value:
if ((nelems)+1 > (size)) \
((v)=cast(t *, luaM_growaux_(L,v,&(size),sizeof(t),limit,e)))
#define cast(t, exp)
Definition: llimits.h:92
GLdouble GLdouble t
Definition: glew.h:1366
GLint limit
Definition: glew.h:10112
const GLdouble * v
Definition: glew.h:1359
GLsizeiptr size
Definition: glew.h:1649
LUAI_FUNC void * luaM_growaux_(lua_State *L, void *block, int *size, size_t size_elem, int limit, const char *what)
Definition: lmem.cpp:45
#define e

Definition at line 39 of file lmem.h.

Referenced by addk(), addprototype(), luaK_code(), new_localvar(), newlabelentry(), newupvalue(), and registerlocalvar().

#define luaM_malloc (   L,
  s 
)    luaM_realloc_(L, NULL, 0, (s))

Definition at line 32 of file lmem.h.

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

Definition at line 33 of file lmem.h.

Referenced by luaE_extendCI().

#define luaM_newobject (   L,
  tag,
  s 
)    luaM_realloc_(L, NULL, tag, (s))

Definition at line 37 of file lmem.h.

Referenced by luaC_newobj().

#define luaM_newvector (   L,
  n,
  t 
)    cast(t *, luaM_reallocv(L, NULL, 0, n, sizeof(t)))

Definition at line 34 of file lmem.h.

Referenced by LoadCode(), LoadConstants(), LoadDebug(), LoadUpvalues(), setnodevector(), and stack_init().

#define luaM_reallocv (   L,
  b,
  on,
  n,
  e 
)
Value:
(cast(void, \
(cast(size_t, (n)+1) > MAX_SIZET/(e)) ? (luaM_toobig(L), 0) : 0), \
luaM_realloc_(L, (b), (on)*(e), (n)*(e)))
#define MAX_SIZET
Definition: llimits.h:29
#define cast(t, exp)
Definition: llimits.h:92
GLdouble GLdouble GLdouble b
Definition: glew.h:6966
LUAI_FUNC void * luaM_realloc_(lua_State *L, void *block, size_t oldsize, size_t size)
Definition: lmem.cpp:74
GLclampd n
Definition: glew.h:5903
LUAI_FUNC l_noret luaM_toobig(lua_State *L)
Definition: lmem.cpp:65
#define e

Definition at line 23 of file lmem.h.

Referenced by luaM_growaux_().

#define luaM_reallocvector (   L,
  v,
  oldn,
  n,
  t 
)    ((v)=cast(t *, luaM_reallocv(L, v, oldn, n, sizeof(t))))

Definition at line 43 of file lmem.h.

Referenced by close_func(), luaD_reallocstack(), luaH_resize(), luaS_resize(), and setarrayvector().

Function Documentation

LUAI_FUNC void* luaM_growaux_ ( lua_State L,
void block,
int size,
size_t  size_elem,
int  limit,
const char *  what 
)

Definition at line 45 of file lmem.cpp.

References luaG_runerror(), luaM_reallocv, and MINSIZEARRAY.

LUAI_FUNC void* luaM_realloc_ ( lua_State L,
void block,
size_t  oldsize,
size_t  size 
)
LUAI_FUNC l_noret luaM_toobig ( lua_State L)

Definition at line 65 of file lmem.cpp.

References luaG_runerror().

Referenced by luaS_newlstr(), and luaS_newudata().