* shrink MKSH_SMALL even further by removing functionality like

some GNU bash extensions (suggested by cnuke@) and bind macros
* make the random cache more efficient (and the code potentially
  smaller, although we have a new implementation of the oaat hash
  function, alongside the old one, now) and pushb only if needed
  (i.e. state has changed or user has set $RANDOM, but not onfork)
This commit is contained in:
tg
2009-09-23 18:04:58 +00:00
parent 1ea1096a4e
commit 1a28786229
10 changed files with 194 additions and 62 deletions

23
main.c
View File

@ -33,7 +33,7 @@
#include <locale.h>
#endif
__RCSID("$MirOS: src/bin/mksh/main.c,v 1.145 2009/09/20 16:40:55 tg Exp $");
__RCSID("$MirOS: src/bin/mksh/main.c,v 1.146 2009/09/23 18:04:57 tg Exp $");
extern char **environ;
@ -1263,6 +1263,27 @@ hash(const char *cp)
return (h);
}
#if !HAVE_ARC4RANDOM || !defined(MKSH_SMALL)
uint32_t
hashmem(const void *cp, size_t len)
{
register uint32_t h = 0;
register const uint8_t *bp = (const uint8_t *)cp;
while (len--) {
h += *bp++;
h += h << 10;
h ^= h >> 6;
}
h += h << 3;
h ^= h >> 11;
h += h << 15;
return (h);
}
#endif
static void
texpand(struct table *tp, size_t nsize)
{