aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRoberto Ierusalimschy <roberto@inf.puc-rio.br>2001-10-25 17:13:33 -0200
committerRoberto Ierusalimschy <roberto@inf.puc-rio.br>2001-10-25 17:13:33 -0200
commitfffb6f3814084cddd8a58e81ae1b73ed78ea0953 (patch)
treed96a3d1d70b651d6ca8fa5ebca0da4b66baf1d2c
parent0b551a24f81153f58bee3c528515e54378c0831a (diff)
downloadlua-fffb6f3814084cddd8a58e81ae1b73ed78ea0953.tar.gz
lua-fffb6f3814084cddd8a58e81ae1b73ed78ea0953.tar.bz2
lua-fffb6f3814084cddd8a58e81ae1b73ed78ea0953.zip
no more MINPOWER2
-rw-r--r--llimits.h6
-rw-r--r--lmem.c13
2 files changed, 9 insertions, 10 deletions
diff --git a/llimits.h b/llimits.h
index 5b5b0203..2bf501d1 100644
--- a/llimits.h
+++ b/llimits.h
@@ -1,5 +1,5 @@
1/* 1/*
2** $Id: llimits.h,v 1.32 2001/09/07 17:39:10 roberto Exp $ 2** $Id: llimits.h,v 1.33 2001/10/02 16:45:03 roberto Exp $
3** Limits, basic types, and some other `installation-dependent' definitions 3** Limits, basic types, and some other `installation-dependent' definitions
4** See Copyright Notice in lua.h 4** See Copyright Notice in lua.h
5*/ 5*/
@@ -71,10 +71,6 @@ typedef unsigned char lu_byte;
71 71
72 72
73 73
74#define MINPOWER2 4 /* minimum size for `growing' vectors */
75
76
77
78#ifndef DEFAULT_STACK_SIZE 74#ifndef DEFAULT_STACK_SIZE
79#define DEFAULT_STACK_SIZE 1024 75#define DEFAULT_STACK_SIZE 1024
80#endif 76#endif
diff --git a/lmem.c b/lmem.c
index 1b7be9fc..32318815 100644
--- a/lmem.c
+++ b/lmem.c
@@ -1,5 +1,5 @@
1/* 1/*
2** $Id: lmem.c,v 1.49 2001/03/26 14:31:49 roberto Exp $ 2** $Id: lmem.c,v 1.50 2001/08/31 19:46:07 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*/
@@ -23,15 +23,18 @@
23#endif 23#endif
24 24
25 25
26#define MINSIZEARRAY 4
27
28
26void *luaM_growaux (lua_State *L, void *block, int *size, int size_elems, 29void *luaM_growaux (lua_State *L, void *block, int *size, int size_elems,
27 int limit, const l_char *errormsg) { 30 int limit, const l_char *errormsg) {
28 void *newblock; 31 void *newblock;
29 int newsize = (*size)*2; 32 int newsize = (*size)*2;
30 if (newsize < MINPOWER2) 33 if (newsize < MINSIZEARRAY)
31 newsize = MINPOWER2; /* minimum size */ 34 newsize = MINSIZEARRAY; /* minimum size */
32 else if (*size >= limit/2) { /* cannot double it? */ 35 else if (*size >= limit/2) { /* cannot double it? */
33 if (*size < limit - MINPOWER2) /* try something smaller... */ 36 if (*size < limit - MINSIZEARRAY) /* try something smaller... */
34 newsize = limit; /* still have at least MINPOWER2 free places */ 37 newsize = limit; /* still have at least MINSIZEARRAY free places */
35 else luaD_error(L, errormsg); 38 else luaD_error(L, errormsg);
36 } 39 }
37 newblock = luaM_realloc(L, block, 40 newblock = luaM_realloc(L, block,