aboutsummaryrefslogtreecommitdiffstats
path: root/Str.c
diff options
context:
space:
mode:
authorTatsuya Kinoshita <tats@debian.org>2021-03-23 10:13:05 +0000
committerTatsuya Kinoshita <tats@debian.org>2021-03-23 10:13:05 +0000
commitd9d9d7b278c9efbcf138bc45dccf06a216a1b69a (patch)
treeddda9c39d11a8da987155fec4ad09ebecad38b00 /Str.c
parentPrevent unneeded memory allocation for language tags in libwc (diff)
downloadw3m-d9d9d7b278c9efbcf138bc45dccf06a216a1b69a.tar.gz
w3m-d9d9d7b278c9efbcf138bc45dccf06a216a1b69a.zip
Reduce memory reallocation due to Strgrow
Diffstat (limited to 'Str.c')
-rw-r--r--Str.c6
1 files changed, 5 insertions, 1 deletions
diff --git a/Str.c b/Str.c
index 9977c2d..f6b7670 100644
--- a/Str.c
+++ b/Str.c
@@ -282,7 +282,11 @@ void
Strgrow(Str x)
{
int newlen, addlen;
- addlen = x->area_size / 5;
+
+ if (x->area_size < 8192)
+ addlen = x->area_size;
+ else
+ addlen = x->area_size / 2;
if (addlen < INITIAL_STR_SIZE)
addlen = INITIAL_STR_SIZE;
newlen = x->area_size + addlen;