aboutsummaryrefslogtreecommitdiff
path: root/lmem.c
diff options
context:
space:
mode:
Diffstat (limited to 'lmem.c')
-rw-r--r--lmem.c10
1 files changed, 5 insertions, 5 deletions
diff --git a/lmem.c b/lmem.c
index ecafef49..2c1757f5 100644
--- a/lmem.c
+++ b/lmem.c
@@ -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? */