From 5aa41b436b3fdf29f5a0046c68cb60b16fa09eb2 Mon Sep 17 00:00:00 2001 From: Li Jin Date: Fri, 30 Sep 2022 11:29:41 +0800 Subject: fix issue #81, refactor continue with gotos. --- src/3rdParty/lua/lauxlib.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'src/3rdParty/lua/lauxlib.c') diff --git a/src/3rdParty/lua/lauxlib.c b/src/3rdParty/lua/lauxlib.c index cba5df9..4ca6c65 100644 --- a/src/3rdParty/lua/lauxlib.c +++ b/src/3rdParty/lua/lauxlib.c @@ -526,14 +526,14 @@ static void newbox (lua_State *L) { /* ** Compute new size for buffer 'B', enough to accommodate extra 'sz' -** bytes. (The test for "double is not big enough" also gets the -** case when the multiplication by 2 overflows.) +** bytes. (The test for "not big enough" also gets the case when the +** computation of 'newsize' overflows.) */ static size_t newbuffsize (luaL_Buffer *B, size_t sz) { - size_t newsize = B->size * 2; /* double buffer size */ + size_t newsize = (B->size / 2) * 3; /* buffer size * 1.5 */ if (l_unlikely(MAX_SIZET - sz < B->n)) /* overflow in (B->n + sz)? */ return luaL_error(B->L, "buffer too large"); - if (newsize < B->n + sz) /* double is not big enough? */ + if (newsize < B->n + sz) /* not big enough? */ newsize = B->n + sz; return newsize; } -- cgit v1.2.3-55-g6feb