diff options
author | Roberto Ierusalimschy <roberto@inf.puc-rio.br> | 2018-01-28 13:13:26 -0200 |
---|---|---|
committer | Roberto Ierusalimschy <roberto@inf.puc-rio.br> | 2018-01-28 13:13:26 -0200 |
commit | e2b15aa21d2f31ccc93e35f50928e26a8d9c84ce (patch) | |
tree | 0c8fe009fffa187be71ea3e268daf1a6e29d6d9a /lmem.c | |
parent | 89110986d7a9e81960261ae682780d5fd06dc4ac (diff) | |
download | lua-e2b15aa21d2f31ccc93e35f50928e26a8d9c84ce.tar.gz lua-e2b15aa21d2f31ccc93e35f50928e26a8d9c84ce.tar.bz2 lua-e2b15aa21d2f31ccc93e35f50928e26a8d9c84ce.zip |
janitor work on casts
Diffstat (limited to 'lmem.c')
-rw-r--r-- | lmem.c | 10 |
1 files changed, 5 insertions, 5 deletions
@@ -1,5 +1,5 @@ | |||
1 | /* | 1 | /* |
2 | ** $Id: lmem.c,v 1.94 2017/12/08 17:28:25 roberto Exp roberto $ | 2 | ** $Id: lmem.c,v 1.95 2017/12/11 12:27:48 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 | */ |
@@ -71,8 +71,8 @@ void *luaM_growaux_ (lua_State *L, void *block, int nelems, int *psize, | |||
71 | } | 71 | } |
72 | lua_assert(nelems + 1 <= size && size <= limit); | 72 | lua_assert(nelems + 1 <= size && size <= limit); |
73 | /* 'limit' ensures that multiplication will not overflow */ | 73 | /* 'limit' ensures that multiplication will not overflow */ |
74 | newblock = luaM_realloc_(L, block, cast(size_t, *psize) * size_elems, | 74 | newblock = luaM_realloc_(L, block, cast_sizet(*psize) * size_elems, |
75 | cast(size_t, size) * size_elems); | 75 | cast_sizet(size) * size_elems); |
76 | if (newblock == NULL) | 76 | if (newblock == NULL) |
77 | luaM_error(L); | 77 | luaM_error(L); |
78 | *psize = size; /* update only when everything else is OK */ | 78 | *psize = size; /* update only when everything else is OK */ |
@@ -84,8 +84,8 @@ void *luaM_shrinkvector_ (lua_State *L, void *block, int *size, | |||
84 | int final_n, int size_elem) { | 84 | int final_n, int size_elem) { |
85 | global_State *g = G(L); | 85 | global_State *g = G(L); |
86 | void *newblock; | 86 | void *newblock; |
87 | size_t oldsize = cast(size_t, (*size) * size_elem); | 87 | size_t oldsize = cast_sizet((*size) * size_elem); |
88 | size_t newsize = cast(size_t, final_n * size_elem); | 88 | size_t newsize = cast_sizet(final_n * size_elem); |
89 | lua_assert(newsize <= oldsize); | 89 | lua_assert(newsize <= oldsize); |
90 | newblock = (*g->frealloc)(g->ud, block, oldsize, newsize); | 90 | newblock = (*g->frealloc)(g->ud, block, oldsize, newsize); |
91 | if (newblock == NULL && final_n > 0) /* allocation failed? */ | 91 | if (newblock == NULL && final_n > 0) /* allocation failed? */ |