annotate src/lua/lmem.h @ 465:34bf4b64d9d1

remove dead code.
author Robert McIntyre <rlm@mit.edu>
date Fri, 04 May 2012 03:55:00 -0500
parents 27763b933818
children
rev   line source
rlm@1 1 /*
rlm@1 2 ** $Id: lmem.h,v 1.31.1.1 2007/12/27 13:02:25 roberto Exp $
rlm@1 3 ** Interface to Memory Manager
rlm@1 4 ** See Copyright Notice in lua.h
rlm@1 5 */
rlm@1 6
rlm@1 7 #ifndef lmem_h
rlm@1 8 #define lmem_h
rlm@1 9
rlm@1 10
rlm@1 11 #include <stddef.h>
rlm@1 12
rlm@1 13 #include "llimits.h"
rlm@1 14 #include "lua.h"
rlm@1 15
rlm@1 16 #define MEMERRMSG "not enough memory"
rlm@1 17
rlm@1 18
rlm@1 19 #define luaM_reallocv(L,b,on,n,e) \
rlm@1 20 ((cast(size_t, (n)+1) <= MAX_SIZET/(e)) ? /* +1 to avoid warnings */ \
rlm@1 21 luaM_realloc_(L, (b), (on)*(e), (n)*(e)) : \
rlm@1 22 luaM_toobig(L))
rlm@1 23
rlm@1 24 #define luaM_freemem(L, b, s) luaM_realloc_(L, (b), (s), 0)
rlm@1 25 #define luaM_free(L, b) luaM_realloc_(L, (b), sizeof(*(b)), 0)
rlm@1 26 #define luaM_freearray(L, b, n, t) luaM_reallocv(L, (b), n, 0, sizeof(t))
rlm@1 27
rlm@1 28 #define luaM_malloc(L,t) luaM_realloc_(L, NULL, 0, (t))
rlm@1 29 #define luaM_new(L,t) cast(t *, luaM_malloc(L, sizeof(t)))
rlm@1 30 #define luaM_newvector(L,n,t) \
rlm@1 31 cast(t *, luaM_reallocv(L, NULL, 0, n, sizeof(t)))
rlm@1 32
rlm@1 33 #define luaM_growvector(L,v,nelems,size,t,limit,e) \
rlm@1 34 if ((nelems)+1 > (size)) \
rlm@1 35 ((v)=cast(t *, luaM_growaux_(L,v,&(size),sizeof(t),limit,e)))
rlm@1 36
rlm@1 37 #define luaM_reallocvector(L, v,oldn,n,t) \
rlm@1 38 ((v)=cast(t *, luaM_reallocv(L, v, oldn, n, sizeof(t))))
rlm@1 39
rlm@1 40
rlm@1 41 LUAI_FUNC void *luaM_realloc_ (lua_State *L, void *block, size_t oldsize,
rlm@1 42 size_t size);
rlm@1 43 LUAI_FUNC void *luaM_toobig (lua_State *L);
rlm@1 44 LUAI_FUNC void *luaM_growaux_ (lua_State *L, void *block, int *size,
rlm@1 45 size_t size_elem, int limit,
rlm@1 46 const char *errormsg);
rlm@1 47
rlm@1 48 #endif
rlm@1 49