diff options
author | Roberto Ierusalimschy <roberto@inf.puc-rio.br> | 2001-02-20 15:15:33 -0300 |
---|---|---|
committer | Roberto Ierusalimschy <roberto@inf.puc-rio.br> | 2001-02-20 15:15:33 -0300 |
commit | 099442c41f2cec6122690e6c8f2e11327613e6f6 (patch) | |
tree | 73599b274ea4a9b96906ff8160eeb4a524702a8e /lmem.h | |
parent | 27600fe87a6fafdfd4ddddeb390591fe749b480f (diff) | |
download | lua-099442c41f2cec6122690e6c8f2e11327613e6f6.tar.gz lua-099442c41f2cec6122690e6c8f2e11327613e6f6.tar.bz2 lua-099442c41f2cec6122690e6c8f2e11327613e6f6.zip |
better separation between basic types
Diffstat (limited to 'lmem.h')
-rw-r--r-- | lmem.h | 13 |
1 files changed, 6 insertions, 7 deletions
@@ -1,5 +1,5 @@ | |||
1 | /* | 1 | /* |
2 | ** $Id: lmem.h,v 1.19 2000/12/28 12:55:41 roberto Exp roberto $ | 2 | ** $Id: lmem.h,v 1.20 2001/02/02 15:13:05 roberto Exp roberto $ |
3 | ** Interface to Memory Manager | 3 | ** Interface to Memory Manager |
4 | ** See Copyright Notice in lua.h | 4 | ** See Copyright Notice in lua.h |
5 | */ | 5 | */ |
@@ -13,8 +13,7 @@ | |||
13 | #include "llimits.h" | 13 | #include "llimits.h" |
14 | #include "lua.h" | 14 | #include "lua.h" |
15 | 15 | ||
16 | void *luaM_realloc (lua_State *L, void *oldblock, luint32 oldsize, | 16 | void *luaM_realloc (lua_State *L, void *oldblock, lu_mem oldsize, lu_mem size); |
17 | luint32 size); | ||
18 | 17 | ||
19 | void *luaM_growaux (lua_State *L, void *block, int *size, int size_elem, | 18 | void *luaM_growaux (lua_State *L, void *block, int *size, int size_elem, |
20 | int limit, const char *errormsg); | 19 | int limit, const char *errormsg); |
@@ -22,20 +21,20 @@ void *luaM_growaux (lua_State *L, void *block, int *size, int size_elem, | |||
22 | #define luaM_free(L, b, s) luaM_realloc(L, (b), (s), 0) | 21 | #define luaM_free(L, b, s) luaM_realloc(L, (b), (s), 0) |
23 | #define luaM_freelem(L, b, t) luaM_realloc(L, (b), sizeof(t), 0) | 22 | #define luaM_freelem(L, b, t) luaM_realloc(L, (b), sizeof(t), 0) |
24 | #define luaM_freearray(L, b, n, t) luaM_realloc(L, (b), \ | 23 | #define luaM_freearray(L, b, n, t) luaM_realloc(L, (b), \ |
25 | ((luint32)(n)*(luint32)sizeof(t)), 0) | 24 | ((lu_mem)(n)*(lu_mem)sizeof(t)), 0) |
26 | 25 | ||
27 | #define luaM_malloc(L, t) luaM_realloc(L, NULL, 0, (t)) | 26 | #define luaM_malloc(L, t) luaM_realloc(L, NULL, 0, (t)) |
28 | #define luaM_new(L, t) ((t *)luaM_malloc(L, sizeof(t))) | 27 | #define luaM_new(L, t) ((t *)luaM_malloc(L, sizeof(t))) |
29 | #define luaM_newvector(L, n,t) ((t *)luaM_malloc(L, \ | 28 | #define luaM_newvector(L, n,t) ((t *)luaM_malloc(L, \ |
30 | (luint32)(n)*(luint32)sizeof(t))) | 29 | (lu_mem)(n)*(lu_mem)sizeof(t))) |
31 | 30 | ||
32 | #define luaM_growvector(L,v,nelems,size,t,limit,e) \ | 31 | #define luaM_growvector(L,v,nelems,size,t,limit,e) \ |
33 | if (((nelems)+1) > (size)) \ | 32 | if (((nelems)+1) > (size)) \ |
34 | ((v)=(t *)luaM_growaux(L,v,&(size),sizeof(t),limit,e)) | 33 | ((v)=(t *)luaM_growaux(L,v,&(size),sizeof(t),limit,e)) |
35 | 34 | ||
36 | #define luaM_reallocvector(L, v,oldn,n,t) \ | 35 | #define luaM_reallocvector(L, v,oldn,n,t) \ |
37 | ((v)=(t *)luaM_realloc(L, v,(luint32)(oldn)*(luint32)sizeof(t), \ | 36 | ((v)=(t *)luaM_realloc(L, v,(lu_mem)(oldn)*(lu_mem)sizeof(t), \ |
38 | (luint32)(n)*(luint32)sizeof(t))) | 37 | (lu_mem)(n)*(lu_mem)sizeof(t))) |
39 | 38 | ||
40 | 39 | ||
41 | #endif | 40 | #endif |