sdk-world v2026.11.05
PS2 SDK - world tier (copyleft-allowed, non-essential packages)
Loading...
Searching...
No Matches
lmem.h File Reference
#include <stddef.h>
#include "llimits.h"
#include "lua.h"

Go to the source code of this file.

Macros

#define luaM_error(L)
#define luaM_testsize(n, e)
#define luaM_checksize(L, n, e)
#define luaM_limitN(n, t)
#define luaM_reallocvchar(L, b, on, n)
#define luaM_freemem(L, b, s)
#define luaM_free(L, b)
#define luaM_freearray(L, b, n)
#define luaM_new(L, t)
#define luaM_newvector(L, n, t)
#define luaM_newvectorchecked(L, n, t)
#define luaM_newobject(L, tag, s)
#define luaM_growvector(L, v, nelems, size, t, limit, e)
#define luaM_reallocvector(L, v, oldn, n, t)
#define luaM_shrinkvector(L, v, size, fs, t)

Functions

LUAI_FUNC l_noret luaM_toobig (lua_State *L)
LUAI_FUNC void * luaM_realloc_ (lua_State *L, void *block, size_t oldsize, size_t size)
LUAI_FUNC void * luaM_saferealloc_ (lua_State *L, void *block, size_t oldsize, size_t size)
LUAI_FUNC void luaM_free_ (lua_State *L, void *block, size_t osize)
LUAI_FUNC void * luaM_growaux_ (lua_State *L, void *block, int nelems, int *size, int size_elem, int limit, const char *what)
LUAI_FUNC void * luaM_shrinkvector_ (lua_State *L, void *block, int *nelem, int final_n, int size_elem)
LUAI_FUNC void * luaM_malloc_ (lua_State *L, size_t size, int tag)

Macro Definition Documentation

◆ luaM_checksize

#define luaM_checksize ( L,
n,
e )
Value:
(luaM_testsize(n,e) ? luaM_toobig(L) : cast_void(0))

Definition at line 38 of file lmem.h.

◆ luaM_error

#define luaM_error ( L)
Value:
luaD_throw(L, LUA_ERRMEM)

Definition at line 21 of file lmem.h.

◆ luaM_free

#define luaM_free ( L,
b )
Value:
luaM_free_(L, (b), sizeof(*(b)))

Definition at line 60 of file lmem.h.

◆ luaM_freearray

#define luaM_freearray ( L,
b,
n )
Value:
luaM_free_(L, (b), (n)*sizeof(*(b)))

Definition at line 61 of file lmem.h.

◆ luaM_freemem

#define luaM_freemem ( L,
b,
s )
Value:
luaM_free_(L, (b), (s))

Definition at line 59 of file lmem.h.

◆ luaM_growvector

#define luaM_growvector ( L,
v,
nelems,
size,
t,
limit,
e )
Value:
((v)=cast(t *, luaM_growaux_(L,v,nelems,&(size),sizeof(t), \
luaM_limitN(limit,t),e)))

Definition at line 70 of file lmem.h.

◆ luaM_limitN

#define luaM_limitN ( n,
t )
Value:
((cast_sizet(n) <= MAX_SIZET/sizeof(t)) ? (n) : \
cast_uint((MAX_SIZET/sizeof(t))))

Definition at line 48 of file lmem.h.

◆ luaM_new

#define luaM_new ( L,
t )
Value:
cast(t*, luaM_malloc_(L, sizeof(t), 0))

Definition at line 63 of file lmem.h.

◆ luaM_newobject

#define luaM_newobject ( L,
tag,
s )
Value:
luaM_malloc_(L, (s), tag)

Definition at line 68 of file lmem.h.

◆ luaM_newvector

#define luaM_newvector ( L,
n,
t )
Value:
cast(t*, luaM_malloc_(L, (n)*sizeof(t), 0))

Definition at line 64 of file lmem.h.

◆ luaM_newvectorchecked

#define luaM_newvectorchecked ( L,
n,
t )
Value:
(luaM_checksize(L,n,sizeof(t)), luaM_newvector(L,n,t))

Definition at line 65 of file lmem.h.

◆ luaM_reallocvchar

#define luaM_reallocvchar ( L,
b,
on,
n )
Value:
cast_charp(luaM_saferealloc_(L, (b), (on)*sizeof(char), (n)*sizeof(char)))

Definition at line 56 of file lmem.h.

◆ luaM_reallocvector

#define luaM_reallocvector ( L,
v,
oldn,
n,
t )
Value:
(cast(t *, luaM_realloc_(L, v, cast_sizet(oldn) * sizeof(t), \
cast_sizet(n) * sizeof(t))))

Definition at line 74 of file lmem.h.

◆ luaM_shrinkvector

#define luaM_shrinkvector ( L,
v,
size,
fs,
t )
Value:
((v)=cast(t *, luaM_shrinkvector_(L, v, &(size), fs, sizeof(t))))

Definition at line 78 of file lmem.h.

◆ luaM_testsize

#define luaM_testsize ( n,
e )
Value:
(sizeof(n) >= sizeof(size_t) && cast_sizet((n)) + 1 > MAX_SIZET/(e))

Definition at line 35 of file lmem.h.

Function Documentation

◆ luaM_free_()

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

Definition at line 150 of file lmem.c.

◆ luaM_growaux_()

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

Definition at line 97 of file lmem.c.

◆ luaM_malloc_()

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

Definition at line 201 of file lmem.c.

◆ luaM_realloc_()

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

Definition at line 176 of file lmem.c.

◆ luaM_saferealloc_()

LUAI_FUNC void * luaM_saferealloc_ ( lua_State * L,
void * block,
size_t oldsize,
size_t size )

Definition at line 192 of file lmem.c.

◆ luaM_shrinkvector_()

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

Definition at line 128 of file lmem.c.

◆ luaM_toobig()

LUAI_FUNC l_noret luaM_toobig ( lua_State * L)

Definition at line 142 of file lmem.c.