diff options
author | Roberto Ierusalimschy <roberto@inf.puc-rio.br> | 2014-12-19 11:45:40 -0200 |
---|---|---|
committer | Roberto Ierusalimschy <roberto@inf.puc-rio.br> | 2014-12-19 11:45:40 -0200 |
commit | 6321041058ec7a597a39df4564f28d5012fd7dfb (patch) | |
tree | 0d098bd12ec7123c307b42b2c8d6dc8cadb7a330 /lmem.h | |
parent | 2b83711fbac0509a40cfb616b9a68bdf683e8471 (diff) | |
download | lua-6321041058ec7a597a39df4564f28d5012fd7dfb.tar.gz lua-6321041058ec7a597a39df4564f28d5012fd7dfb.tar.bz2 lua-6321041058ec7a597a39df4564f28d5012fd7dfb.zip |
new macro 'luaM_reallocvchar' to allocate arrays of chars (avoids
uneeded tests and respective warnings)
Diffstat (limited to 'lmem.h')
-rw-r--r-- | lmem.h | 7 |
1 files changed, 6 insertions, 1 deletions
@@ -1,5 +1,5 @@ | |||
1 | /* | 1 | /* |
2 | ** $Id: lmem.h,v 1.40 2013/02/20 14:08:21 roberto Exp roberto $ | 2 | ** $Id: lmem.h,v 1.41 2014/10/08 20:25:51 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 | */ |
@@ -32,6 +32,11 @@ | |||
32 | ? luaM_toobig(L) : cast_void(0)) , \ | 32 | ? luaM_toobig(L) : cast_void(0)) , \ |
33 | luaM_realloc_(L, (b), (on)*(e), (n)*(e))) | 33 | luaM_realloc_(L, (b), (on)*(e), (n)*(e))) |
34 | 34 | ||
35 | /* | ||
36 | ** Arrays of chars do not need any test | ||
37 | */ | ||
38 | #define luaM_reallocvchar(L,b,on,n) luaM_realloc_(L, (b), (on), (n)) | ||
39 | |||
35 | #define luaM_freemem(L, b, s) luaM_realloc_(L, (b), (s), 0) | 40 | #define luaM_freemem(L, b, s) luaM_realloc_(L, (b), (s), 0) |
36 | #define luaM_free(L, b) luaM_realloc_(L, (b), sizeof(*(b)), 0) | 41 | #define luaM_free(L, b) luaM_realloc_(L, (b), sizeof(*(b)), 0) |
37 | #define luaM_freearray(L, b, n) luaM_realloc_(L, (b), (n)*sizeof(*(b)), 0) | 42 | #define luaM_freearray(L, b, n) luaM_realloc_(L, (b), (n)*sizeof(*(b)), 0) |