From 67714b270a131ff67772c07b8feb8680e6df4205 Mon Sep 17 00:00:00 2001 From: tg Date: Sun, 1 Jul 2012 15:38:09 +0000 Subject: [PATCH] =?UTF-8?q?dissolve=20the=20hashtab=20nonsense,=20=C2=BE?= =?UTF-8?q?=20is=20good,=20and=20mirkev=20will=20also=20use=20that?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- main.c | 23 +++++++++-------------- sh.h | 9 ++------- syn.c | 6 +++--- var.c | 10 +++++----- 4 files changed, 19 insertions(+), 29 deletions(-) diff --git a/main.c b/main.c index ebae37b..3507509 100644 --- a/main.c +++ b/main.c @@ -34,7 +34,7 @@ #include #endif -__RCSID("$MirOS: src/bin/mksh/main.c,v 1.224 2012/06/28 20:05:08 tg Exp $"); +__RCSID("$MirOS: src/bin/mksh/main.c,v 1.225 2012/07/01 15:38:06 tg Exp $"); extern char **environ; @@ -238,8 +238,8 @@ main_init(int argc, const char *argv[], Source **sp, struct block **lp) /* define built-in commands and see if we were called as one */ ktinit(APERM, &builtins, - /* currently up to 50 builtins */ - /* 80% of 64 = 2^6 */ 6, /* 66% of 128 = 2^7 */ 7); + /* currently up to 50 builtins: 75% of 128 = 2^7 */ + 7); for (i = 0; mkshbuiltins[i].name != NULL; i++) if (!strcmp(ccp, builtin(mkshbuiltins[i].name, mkshbuiltins[i].func))) @@ -267,10 +267,10 @@ main_init(int argc, const char *argv[], Source **sp, struct block **lp) coproc_init(); /* set up variable and command dictionaries */ - ktinit(APERM, &taliases, 0, 0); - ktinit(APERM, &aliases, 0, 0); + ktinit(APERM, &taliases, 0); + ktinit(APERM, &aliases, 0); #ifndef MKSH_NOPWNAM - ktinit(APERM, &homedirs, 0, 0); + ktinit(APERM, &homedirs, 0); #endif /* define shell keywords */ @@ -1598,13 +1598,8 @@ tgrow(struct table *tp) /* table can get very full when reaching its size limit */ tp->nfree = (tp->tshift == 30) ? 0x3FFF0000UL : - /* but otherwise, only 80% (MKSH_SMALL) or 66% (normal) */ -#ifdef MKSH_SMALL - ((i * 4) / 5) -#else - ((i * 2) / 3) -#endif - ; + /* but otherwise, only 75% */ + ((i * 3) / 4); tp->tbls = ntblp; if (otblp == NULL) return; @@ -1634,7 +1629,7 @@ tgrow(struct table *tp) } void -ktinit_real(Area *ap, struct table *tp, uint8_t initshift) +ktinit(Area *ap, struct table *tp, uint8_t initshift) { tp->areap = ap; tp->tbls = NULL; diff --git a/sh.h b/sh.h index 152d191..e548dc2 100644 --- a/sh.h +++ b/sh.h @@ -157,7 +157,7 @@ #endif #ifdef EXTERN -__RCSID("$MirOS: src/bin/mksh/sh.h,v 1.568 2012/06/28 20:17:37 tg Exp $"); +__RCSID("$MirOS: src/bin/mksh/sh.h,v 1.569 2012/07/01 15:38:07 tg Exp $"); #endif #define MKSH_VERSION "R40 2012/06/28" @@ -1816,12 +1816,7 @@ void coproc_write_close(int); int coproc_getfd(int, const char **); void coproc_cleanup(int); struct temp *maketemp(Area *, Temp_type, struct temp **); -void ktinit_real(Area *, struct table *, uint8_t); -#ifdef MKSH_SMALL -#define ktinit(ap, tp, s80, s66) ktinit_real((ap), (tp), (s80)) -#else -#define ktinit(ap, tp, s80, s66) ktinit_real((ap), (tp), (s66)) -#endif +void ktinit(Area *, struct table *, uint8_t); struct tbl *ktscan(struct table *, const char *, uint32_t, struct tbl ***); /* table, name (key) to search for, hash(n) */ #define ktsearch(tp, s, h) ktscan((tp), (s), (h), NULL) diff --git a/syn.c b/syn.c index 643fdef..2155439 100644 --- a/syn.c +++ b/syn.c @@ -23,7 +23,7 @@ #include "sh.h" -__RCSID("$MirOS: src/bin/mksh/syn.c,v 1.76 2012/06/28 20:04:02 tg Exp $"); +__RCSID("$MirOS: src/bin/mksh/syn.c,v 1.77 2012/07/01 15:38:08 tg Exp $"); extern short subshell_nesting_level; extern void yyskiputf8bom(void); @@ -810,8 +810,8 @@ initkeywords(void) struct tbl *p; ktinit(APERM, &keywords, - /* currently 28 keywords */ - /* 80% of 64 = 2^6 */ 6, /* 66% of 64 = 2^6 */ 6); + /* currently 28 keywords: 75% of 64 = 2^6 */ + 6); for (tt = tokentab; tt->name; tt++) { if (tt->reserved) { p = ktenter(&keywords, tt->name, hash(tt->name)); diff --git a/var.c b/var.c index 8cb603b..f8c91b4 100644 --- a/var.c +++ b/var.c @@ -27,7 +27,7 @@ #include #endif -__RCSID("$MirOS: src/bin/mksh/var.c,v 1.151 2012/06/28 20:02:29 tg Exp $"); +__RCSID("$MirOS: src/bin/mksh/var.c,v 1.152 2012/07/01 15:38:09 tg Exp $"); /*- * Variables @@ -74,8 +74,8 @@ newblock(void) l->argv = e->loc->argv; } l->exit = l->error = NULL; - ktinit(&l->area, &l->vars, 0, 0); - ktinit(&l->area, &l->funs, 0, 0); + ktinit(&l->area, &l->vars, 0); + ktinit(&l->area, &l->funs, 0); l->next = e->loc; e->loc = l; } @@ -130,8 +130,8 @@ initvar(void) struct tbl *tp; ktinit(APERM, &specials, - /* currently 12 specials */ - /* 80% of 16 = 2^4 */ 4, /* 66% of 32 = 2^5 */ 5); + /* currently 12 specials: 75% of 16 = 2^4 */ + 4); while (i < V_MAX - 1) { tp = ktenter(&specials, initvar_names[i], hash(initvar_names[i]));