aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--lauxlib.c8
-rw-r--r--luaconf.h5
2 files changed, 7 insertions, 6 deletions
diff --git a/lauxlib.c b/lauxlib.c
index cba5df9b..4ca6c654 100644
--- a/lauxlib.c
+++ b/lauxlib.c
@@ -526,14 +526,14 @@ static void newbox (lua_State *L) {
526 526
527/* 527/*
528** Compute new size for buffer 'B', enough to accommodate extra 'sz' 528** Compute new size for buffer 'B', enough to accommodate extra 'sz'
529** bytes. (The test for "double is not big enough" also gets the 529** bytes. (The test for "not big enough" also gets the case when the
530** case when the multiplication by 2 overflows.) 530** computation of 'newsize' overflows.)
531*/ 531*/
532static size_t newbuffsize (luaL_Buffer *B, size_t sz) { 532static size_t newbuffsize (luaL_Buffer *B, size_t sz) {
533 size_t newsize = B->size * 2; /* double buffer size */ 533 size_t newsize = (B->size / 2) * 3; /* buffer size * 1.5 */
534 if (l_unlikely(MAX_SIZET - sz < B->n)) /* overflow in (B->n + sz)? */ 534 if (l_unlikely(MAX_SIZET - sz < B->n)) /* overflow in (B->n + sz)? */
535 return luaL_error(B->L, "buffer too large"); 535 return luaL_error(B->L, "buffer too large");
536 if (newsize < B->n + sz) /* double is not big enough? */ 536 if (newsize < B->n + sz) /* not big enough? */
537 newsize = B->n + sz; 537 newsize = B->n + sz;
538 return newsize; 538 return newsize;
539} 539}
diff --git a/luaconf.h b/luaconf.h
index fcc0018b..e4650fbc 100644
--- a/luaconf.h
+++ b/luaconf.h
@@ -747,14 +747,15 @@
747 747
748/* 748/*
749@@ LUA_IDSIZE gives the maximum size for the description of the source 749@@ LUA_IDSIZE gives the maximum size for the description of the source
750@@ of a function in debug information. 750** of a function in debug information.
751** CHANGE it if you want a different size. 751** CHANGE it if you want a different size.
752*/ 752*/
753#define LUA_IDSIZE 60 753#define LUA_IDSIZE 60
754 754
755 755
756/* 756/*
757@@ LUAL_BUFFERSIZE is the buffer size used by the lauxlib buffer system. 757@@ LUAL_BUFFERSIZE is the initial buffer size used by the lauxlib
758** buffer system.
758*/ 759*/
759#define LUAL_BUFFERSIZE ((int)(16 * sizeof(void*) * sizeof(lua_Number))) 760#define LUAL_BUFFERSIZE ((int)(16 * sizeof(void*) * sizeof(lua_Number)))
760 761