summaryrefslogtreecommitdiff
path: root/lmem.h
diff options
context:
space:
mode:
authorRoberto Ierusalimschy <roberto@inf.puc-rio.br>2000-12-26 16:46:09 -0200
committerRoberto Ierusalimschy <roberto@inf.puc-rio.br>2000-12-26 16:46:09 -0200
commit8c49e198654567f770a7d5081b886a7c35201d81 (patch)
tree8c1de3e885ef138574e51a8868f175feeaab71e2 /lmem.h
parent6af005ec20323defd2a5ead01e2d389462884d04 (diff)
downloadlua-github-8c49e198654567f770a7d5081b886a7c35201d81.tar.gz
explicit control of size for growing vectors
Diffstat (limited to 'lmem.h')
-rw-r--r--lmem.h12
1 files changed, 6 insertions, 6 deletions
diff --git a/lmem.h b/lmem.h
index 8147de5c..c2ee8213 100644
--- a/lmem.h
+++ b/lmem.h
@@ -1,5 +1,5 @@
/*
-** $Id: lmem.h,v 1.16 2000/10/30 16:29:59 roberto Exp roberto $
+** $Id: lmem.h,v 1.17 2000/11/24 17:39:56 roberto Exp roberto $
** Interface to Memory Manager
** See Copyright Notice in lua.h
*/
@@ -14,17 +14,17 @@
#include "lua.h"
void *luaM_realloc (lua_State *L, void *oldblock, luint32 size);
-void *luaM_growaux (lua_State *L, void *block, size_t nelems,
- int inc, size_t size, const char *errormsg,
- size_t limit);
+void *luaM_growaux (lua_State *L, void *block, int *size, int size_elem,
+ int limit, const char *errormsg);
#define luaM_free(L, b) luaM_realloc(L, (b), 0)
#define luaM_malloc(L, t) luaM_realloc(L, NULL, (t))
#define luaM_new(L, t) ((t *)luaM_malloc(L, sizeof(t)))
#define luaM_newvector(L, n,t) ((t *)luaM_malloc(L, (n)*(luint32)sizeof(t)))
-#define luaM_growvector(L, v,nelems,inc,t,e,l) \
- ((v)=(t *)luaM_growaux(L, v,nelems,inc,sizeof(t),e,l))
+#define luaM_growvector(L,v,nelems,size,t,limit,e) \
+ if (((nelems)+1) > (size)) \
+ ((v)=(t *)luaM_growaux(L,v,&(size),sizeof(t),limit,e))
#define luaM_reallocvector(L, v,n,t) \
((v)=(t *)luaM_realloc(L, v,(n)*(luint32)sizeof(t)))