From 546d5d0def444a6b6e2f45272947b35852936ac1 Mon Sep 17 00:00:00 2001 From: tg Date: Sat, 15 Nov 2008 09:00:19 +0000 Subject: [PATCH] give hints to anew() according to aalloc stats output for testsuite and a little interactive use, to reduce the number realloc(3) must be called --- edit.c | 4 ++-- main.c | 10 +++++----- var.c | 4 ++-- 3 files changed, 9 insertions(+), 9 deletions(-) diff --git a/edit.c b/edit.c index 036349e..9502d3e 100644 --- a/edit.c +++ b/edit.c @@ -5,7 +5,7 @@ #include "sh.h" -__RCSID("$MirOS: src/bin/mksh/edit.c,v 1.145 2008/11/15 07:35:23 tg Exp $"); +__RCSID("$MirOS: src/bin/mksh/edit.c,v 1.146 2008/11/15 09:00:18 tg Exp $"); /* tty driver characters we are interested in */ typedef struct { @@ -2681,7 +2681,7 @@ x_init_emacs(void) { int i, j; - AEDIT = anew(0); + AEDIT = anew(8); x_nextcmd = -1; x_tab = alloc(X_NTABS, sizeof (*x_tab), AEDIT); diff --git a/main.c b/main.c index 6dc4eb3..ba5c6e4 100644 --- a/main.c +++ b/main.c @@ -13,7 +13,7 @@ #include #endif -__RCSID("$MirOS: src/bin/mksh/main.c,v 1.112 2008/11/15 08:42:35 tg Exp $"); +__RCSID("$MirOS: src/bin/mksh/main.c,v 1.113 2008/11/15 09:00:19 tg Exp $"); extern char **environ; @@ -91,11 +91,11 @@ main(int argc, const char *argv[]) } kshname = *argv; - APERM = anew(0); /* initialise permanent Area */ + APERM = anew(256); /* initialise permanent Area */ /* set up base environment */ env.type = E_NONE; - env.areap = anew(0); + env.areap = anew(32); newblock(); /* set up global l->vars and l->funs */ /* Do this first so output routines (eg, errorf, shellf) can work */ @@ -614,7 +614,7 @@ newenv(int type) ep = alloc(1, sizeof (struct env), ATEMP); ep->type = type; ep->flags = 0; - ep->areap = anew(0); + ep->areap = anew(16); ep->loc = e->loc; ep->savefd = NULL; ep->oenv = e; @@ -720,7 +720,7 @@ reclaim(bool finish) e->temps = NULL; adelete(&e->areap); if (!finish) - e->areap = anew(0); + e->areap = anew(16); } static void diff --git a/var.c b/var.c index 4759e50..317aa63 100644 --- a/var.c +++ b/var.c @@ -2,7 +2,7 @@ #include "sh.h" -__RCSID("$MirOS: src/bin/mksh/var.c,v 1.61 2008/11/15 07:35:25 tg Exp $"); +__RCSID("$MirOS: src/bin/mksh/var.c,v 1.62 2008/11/15 09:00:19 tg Exp $"); /* * Variables @@ -39,7 +39,7 @@ newblock(void) l = alloc(1, sizeof (struct block), ATEMP); l->flags = 0; - l->areap = anew(0); /* TODO: could use e->area */ + l->areap = anew(Flag(FTALKING) ? 1024 : 64); if (!e->loc) { l->argc = 0; l->argv = empty;