Correct mistake when doing hashtable lookup collision resolution… oops

This commit is contained in:
tg 2012-12-07 23:46:38 +00:00
parent 98b6cd9b8d
commit c4e88acd83
3 changed files with 8 additions and 8 deletions

View File

@ -1,4 +1,4 @@
# $MirOS: src/bin/mksh/check.t,v 1.572 2012/12/07 23:43:09 tg Exp $
# $MirOS: src/bin/mksh/check.t,v 1.573 2012/12/07 23:46:33 tg Exp $
# $OpenBSD: bksl-nl.t,v 1.2 2001/01/28 23:04:56 niklas Exp $
# $OpenBSD: history.t,v 1.5 2001/01/28 23:04:56 niklas Exp $
# $OpenBSD: read.t,v 1.3 2003/03/10 03:48:16 david Exp $
@ -29,7 +29,7 @@
# http://www.freebsd.org/cgi/cvsweb.cgi/src/tools/regression/bin/test/regress.sh?rev=HEAD
expected-stdout:
@(#)MIRBSD KSH R41 2012/12/05
@(#)MIRBSD KSH R41 2012/12/07
description:
Check version of shell.
stdin:
@ -38,7 +38,7 @@ name: KSH_VERSION
category: shell:legacy-no
---
expected-stdout:
@(#)LEGACY KSH R41 2012/12/05
@(#)LEGACY KSH R41 2012/12/07
description:
Check version of legacy shell.
stdin:

6
main.c
View File

@ -34,7 +34,7 @@
#include <locale.h>
#endif
__RCSID("$MirOS: src/bin/mksh/main.c,v 1.247 2012/12/05 19:38:21 tg Exp $");
__RCSID("$MirOS: src/bin/mksh/main.c,v 1.248 2012/12/07 23:46:36 tg Exp $");
extern char **environ;
@ -1654,7 +1654,7 @@ tgrow(struct table *tp)
if ((tblp = otblp[i]) != NULL) {
if ((tblp->flag & DEFINED)) {
/* search for free hash table slot */
j = (perturb = tblp->ua.hval) & mask;
j = perturb = tblp->ua.hval;
goto find_first_empty_slot;
find_next_empty_slot:
j = (j << 2) + j + perturb + 1;
@ -1692,7 +1692,7 @@ ktscan(struct table *tp, const char *name, uint32_t h, struct tbl ***ppp)
mask = ((size_t)1 << (tp->tshift)) - 1;
/* search for hash table slot matching name */
j = (perturb = h) & mask;
j = perturb = h;
goto find_first_slot;
find_next_slot:
j = (j << 2) + j + perturb + 1;

4
sh.h
View File

@ -152,9 +152,9 @@
#endif
#ifdef EXTERN
__RCSID("$MirOS: src/bin/mksh/sh.h,v 1.614 2012/12/05 19:38:23 tg Exp $");
__RCSID("$MirOS: src/bin/mksh/sh.h,v 1.615 2012/12/07 23:46:38 tg Exp $");
#endif
#define MKSH_VERSION "R41 2012/12/05"
#define MKSH_VERSION "R41 2012/12/07"
/* arithmetic types: C implementation */
#if !HAVE_CAN_INTTYPES