no more MINPOWER2
This commit is contained in:
@@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
** $Id: llimits.h,v 1.32 2001/09/07 17:39:10 roberto Exp $
|
** $Id: llimits.h,v 1.33 2001/10/02 16:45:03 roberto Exp $
|
||||||
** Limits, basic types, and some other `installation-dependent' definitions
|
** Limits, basic types, and some other `installation-dependent' definitions
|
||||||
** See Copyright Notice in lua.h
|
** See Copyright Notice in lua.h
|
||||||
*/
|
*/
|
||||||
@@ -71,10 +71,6 @@ typedef unsigned char lu_byte;
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
#define MINPOWER2 4 /* minimum size for `growing' vectors */
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
#ifndef DEFAULT_STACK_SIZE
|
#ifndef DEFAULT_STACK_SIZE
|
||||||
#define DEFAULT_STACK_SIZE 1024
|
#define DEFAULT_STACK_SIZE 1024
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
13
lmem.c
13
lmem.c
@@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
** $Id: lmem.c,v 1.49 2001/03/26 14:31:49 roberto Exp $
|
** $Id: lmem.c,v 1.50 2001/08/31 19:46:07 roberto Exp $
|
||||||
** Interface to Memory Manager
|
** Interface to Memory Manager
|
||||||
** See Copyright Notice in lua.h
|
** See Copyright Notice in lua.h
|
||||||
*/
|
*/
|
||||||
@@ -23,15 +23,18 @@
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
||||||
|
#define MINSIZEARRAY 4
|
||||||
|
|
||||||
|
|
||||||
void *luaM_growaux (lua_State *L, void *block, int *size, int size_elems,
|
void *luaM_growaux (lua_State *L, void *block, int *size, int size_elems,
|
||||||
int limit, const l_char *errormsg) {
|
int limit, const l_char *errormsg) {
|
||||||
void *newblock;
|
void *newblock;
|
||||||
int newsize = (*size)*2;
|
int newsize = (*size)*2;
|
||||||
if (newsize < MINPOWER2)
|
if (newsize < MINSIZEARRAY)
|
||||||
newsize = MINPOWER2; /* minimum size */
|
newsize = MINSIZEARRAY; /* minimum size */
|
||||||
else if (*size >= limit/2) { /* cannot double it? */
|
else if (*size >= limit/2) { /* cannot double it? */
|
||||||
if (*size < limit - MINPOWER2) /* try something smaller... */
|
if (*size < limit - MINSIZEARRAY) /* try something smaller... */
|
||||||
newsize = limit; /* still have at least MINPOWER2 free places */
|
newsize = limit; /* still have at least MINSIZEARRAY free places */
|
||||||
else luaD_error(L, errormsg);
|
else luaD_error(L, errormsg);
|
||||||
}
|
}
|
||||||
newblock = luaM_realloc(L, block,
|
newblock = luaM_realloc(L, block,
|
||||||
|
|||||||
Reference in New Issue
Block a user