23 #define luaM_reallocv(L,b,on,n,e) \
25 (cast(size_t, (n)+1) > MAX_SIZET/(e)) ? (luaM_toobig(L), 0) : 0), \
26 luaM_realloc_(L, (b), (on)*(e), (n)*(e)))
28 #define luaM_freemem(L, b, s) luaM_realloc_(L, (b), (s), 0)
29 #define luaM_free(L, b) luaM_realloc_(L, (b), sizeof(*(b)), 0)
30 #define luaM_freearray(L, b, n) luaM_reallocv(L, (b), n, 0, sizeof((b)[0]))
32 #define luaM_malloc(L,s) luaM_realloc_(L, NULL, 0, (s))
33 #define luaM_new(L,t) cast(t *, luaM_malloc(L, sizeof(t)))
34 #define luaM_newvector(L,n,t) \
35 cast(t *, luaM_reallocv(L, NULL, 0, n, sizeof(t)))
37 #define luaM_newobject(L,tag,s) luaM_realloc_(L, NULL, tag, (s))
39 #define luaM_growvector(L,v,nelems,size,t,limit,e) \
40 if ((nelems)+1 > (size)) \
41 ((v)=cast(t *, luaM_growaux_(L,v,&(size),sizeof(t),limit,e)))
43 #define luaM_reallocvector(L, v,oldn,n,t) \
44 ((v)=cast(t *, luaM_reallocv(L, v, oldn, n, sizeof(t))))
52 size_t size_elem,
int limit,
const char * what() const
LUAI_FUNC void * luaM_realloc_(lua_State *L, void *block, size_t oldsize, size_t size)
static void block(LexState *ls)
LUAI_FUNC void * luaM_growaux_(lua_State *L, void *block, int *size, size_t size_elem, int limit, const char *what)
LUAI_FUNC l_noret luaM_toobig(lua_State *L)