diff options
| author | Roberto Ierusalimschy <roberto@inf.puc-rio.br> | 2001-08-31 16:46:07 -0300 |
|---|---|---|
| committer | Roberto Ierusalimschy <roberto@inf.puc-rio.br> | 2001-08-31 16:46:07 -0300 |
| commit | e1d072571ec6f9d830e575a2ecdc95fd43428e53 (patch) | |
| tree | 830fab7f2acb9adaee2d63073d339cc9557a5437 /lmem.h | |
| parent | 7651a5c6b2ee6ec59cadec6199319d482071f176 (diff) | |
| download | lua-e1d072571ec6f9d830e575a2ecdc95fd43428e53.tar.gz lua-e1d072571ec6f9d830e575a2ecdc95fd43428e53.tar.bz2 lua-e1d072571ec6f9d830e575a2ecdc95fd43428e53.zip | |
better syntax for type casts
Diffstat (limited to 'lmem.h')
| -rw-r--r-- | lmem.h | 16 |
1 files changed, 8 insertions, 8 deletions
| @@ -1,5 +1,5 @@ | |||
| 1 | /* | 1 | /* |
| 2 | ** $Id: lmem.h,v 1.21 2001/02/20 18:15:33 roberto Exp roberto $ | 2 | ** $Id: lmem.h,v 1.22 2001/02/23 17:17:25 roberto Exp $ |
| 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 | */ |
| @@ -21,20 +21,20 @@ void *luaM_growaux (lua_State *L, void *block, int *size, int size_elem, | |||
| 21 | #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) |
| 22 | #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) |
| 23 | #define luaM_freearray(L, b, n, t) luaM_realloc(L, (b), \ | 23 | #define luaM_freearray(L, b, n, t) luaM_realloc(L, (b), \ |
| 24 | ((lu_mem)(n)*(lu_mem)sizeof(t)), 0) | 24 | cast(lu_mem, n)*cast(lu_mem, sizeof(t)), 0) |
| 25 | 25 | ||
| 26 | #define luaM_malloc(L, t) luaM_realloc(L, NULL, 0, (t)) | 26 | #define luaM_malloc(L, t) luaM_realloc(L, NULL, 0, (t)) |
| 27 | #define luaM_new(L, t) ((t *)luaM_malloc(L, sizeof(t))) | 27 | #define luaM_new(L, t) cast(t *, luaM_malloc(L, sizeof(t))) |
| 28 | #define luaM_newvector(L, n,t) ((t *)luaM_malloc(L, \ | 28 | #define luaM_newvector(L, n,t) cast(t *, luaM_malloc(L, \ |
| 29 | (lu_mem)(n)*(lu_mem)sizeof(t))) | 29 | cast(lu_mem, n)*cast(lu_mem, sizeof(t)))) |
| 30 | 30 | ||
| 31 | #define luaM_growvector(L,v,nelems,size,t,limit,e) \ | 31 | #define luaM_growvector(L,v,nelems,size,t,limit,e) \ |
| 32 | if (((nelems)+1) > (size)) \ | 32 | if (((nelems)+1) > (size)) \ |
| 33 | ((v)=(t *)luaM_growaux(L,v,&(size),sizeof(t),limit,e)) | 33 | ((v)=cast(t *, luaM_growaux(L,v,&(size),sizeof(t),limit,e))) |
| 34 | 34 | ||
| 35 | #define luaM_reallocvector(L, v,oldn,n,t) \ | 35 | #define luaM_reallocvector(L, v,oldn,n,t) \ |
| 36 | ((v)=(t *)luaM_realloc(L, v,(lu_mem)(oldn)*(lu_mem)sizeof(t), \ | 36 | ((v)=cast(t *, luaM_realloc(L, v,cast(lu_mem, oldn)*cast(lu_mem, sizeof(t)), \ |
| 37 | (lu_mem)(n)*(lu_mem)sizeof(t))) | 37 | cast(lu_mem, n)*cast(lu_mem, sizeof(t))))) |
| 38 | 38 | ||
| 39 | 39 | ||
| 40 | #endif | 40 | #endif |
