The Battle for Wesnoth  1.17.0-dev
Macros | Functions
lmem.cpp File Reference
#include "lprefix.h"
#include <stddef.h>
#include "lua.h"
#include "ldebug.h"
#include "ldo.h"
#include "lgc.h"
#include "lmem.h"
#include "lobject.h"
#include "lstate.h"
Include dependency graph for lmem.cpp:

Go to the source code of this file.

Macros

#define lmem_c
 
#define LUA_CORE
 
#define firsttry(g, block, os, ns)   ((*g->frealloc)(g->ud, block, os, ns))
 
#define MINSIZEARRAY   4
 

Functions

void * luaM_growaux_ (lua_State *L, void *block, int nelems, int *psize, int size_elems, int limit, const char *what)
 
void * luaM_shrinkvector_ (lua_State *L, void *block, int *size, int final_n, int size_elem)
 
l_noret luaM_toobig (lua_State *L)
 
void luaM_free_ (lua_State *L, void *block, size_t osize)
 
static void * tryagain (lua_State *L, void *block, size_t osize, size_t nsize)
 
void * luaM_realloc_ (lua_State *L, void *block, size_t osize, size_t nsize)
 
void * luaM_saferealloc_ (lua_State *L, void *block, size_t osize, size_t nsize)
 
void * luaM_malloc_ (lua_State *L, size_t size, int tag)
 

Macro Definition Documentation

◆ firsttry

#define firsttry (   g,
  block,
  os,
  ns 
)    ((*g->frealloc)(g->ud, block, os, ns))

Definition at line 38 of file lmem.cpp.

Referenced by luaM_malloc_(), and luaM_realloc_().

◆ lmem_c

#define lmem_c

Definition at line 7 of file lmem.cpp.

◆ LUA_CORE

#define LUA_CORE

Definition at line 8 of file lmem.cpp.

◆ MINSIZEARRAY

#define MINSIZEARRAY   4

Definition at line 76 of file lmem.cpp.

Referenced by luaM_growaux_().

Function Documentation

◆ luaM_free_()

void luaM_free_ ( lua_State L,
void *  block,
size_t  osize 
)

Definition at line 132 of file lmem.cpp.

References global_State::frealloc, g, G, global_State::GCdebt, lua_assert, and global_State::ud.

◆ luaM_growaux_()

void* luaM_growaux_ ( lua_State L,
void *  block,
int  nelems,
int *  psize,
int  size_elems,
int  limit,
const char *  what 
)

◆ luaM_malloc_()

void* luaM_malloc_ ( lua_State L,
size_t  size,
int  tag 
)

Definition at line 188 of file lmem.cpp.

References firsttry, g, G, global_State::GCdebt, luaM_error, utf8::size(), tryagain(), and unlikely.

◆ luaM_realloc_()

void* luaM_realloc_ ( lua_State L,
void *  block,
size_t  osize,
size_t  nsize 
)

Definition at line 162 of file lmem.cpp.

References firsttry, g, G, global_State::GCdebt, lua_assert, tryagain(), and unlikely.

Referenced by luaM_saferealloc_().

◆ luaM_saferealloc_()

void* luaM_saferealloc_ ( lua_State L,
void *  block,
size_t  osize,
size_t  nsize 
)

Definition at line 179 of file lmem.cpp.

References luaM_error, luaM_realloc_(), and unlikely.

Referenced by luaM_growaux_(), and luaM_shrinkvector_().

◆ luaM_shrinkvector_()

void* luaM_shrinkvector_ ( lua_State L,
void *  block,
int *  size,
int  final_n,
int  size_elem 
)

Definition at line 110 of file lmem.cpp.

References cast_sizet, lua_assert, and luaM_saferealloc_().

◆ luaM_toobig()

l_noret luaM_toobig ( lua_State L)

Definition at line 124 of file lmem.cpp.

References luaG_runerror().

Referenced by luaS_newlstr(), and luaS_newudata().

◆ tryagain()

static void* tryagain ( lua_State L,
void *  block,
size_t  osize,
size_t  nsize 
)
static