for now, until we really use kt*() otherwise, ifdef out tablep/hval

This commit is contained in:
tg
2009-08-28 20:38:43 +00:00
parent 4ccdfc8508
commit bb7a720a00
4 changed files with 29 additions and 6 deletions

18
main.c
View File

@ -33,7 +33,7 @@
#include <locale.h>
#endif
__RCSID("$MirOS: src/bin/mksh/main.c,v 1.140 2009/08/28 20:30:57 tg Exp $");
__RCSID("$MirOS: src/bin/mksh/main.c,v 1.141 2009/08/28 20:38:42 tg Exp $");
extern char **environ;
@ -1278,8 +1278,13 @@ texpand(struct table *tp, size_t nsize)
for (i = 0; i < osize; i++)
if ((tblp = otblp[i]) != NULL) {
if ((tblp->flag & DEFINED)) {
#ifdef notyet_ktremove
for (p = &ntblp[tblp->hval &
(tp->size - 1)]; *p != NULL; p--)
#else
for (p = &ntblp[hash(tblp->name) &
(tp->size - 1)]; *p != NULL; p--)
#endif
if (p == ntblp) /* wrap */
p += tp->size;
*p = tblp;
@ -1309,7 +1314,12 @@ ktscan(struct table *tp, const char *n, uint32_t h, struct tbl ***ppp)
/* search for name in hashed table */
for (pp = &tp->tbls[h & (tp->size - 1)]; (p = *pp) != NULL; pp--) {
#ifdef notyet_ktremove
if (p->hval == h && !strcmp(p->name, n) && (p->flag & DEFINED))
#else
if (*p->name == *n && !strcmp(p->name, n) &&
(p->flag & DEFINED))
#endif
goto found;
if (pp == tp->tbls)
/* wrap */
@ -1356,8 +1366,10 @@ ktenter(struct table *tp, const char *n, uint32_t h)
p->flag = 0;
p->type = 0;
p->areap = tp->areap;
#ifdef notyet_ktremove
p->tablep = tp;
p->hval = h;
#endif
p->u2.field = 0;
p->u.array = NULL;
memcpy(p->name, n, len);
@ -1368,8 +1380,9 @@ ktenter(struct table *tp, const char *n, uint32_t h)
return (p);
}
#ifdef notyet_ktremove
void
ktdelete(struct tbl *p)
ktremove(struct tbl *p)
{
struct tbl **pp;
@ -1385,6 +1398,7 @@ ktdelete(struct tbl *p)
p->flag = 0;
}
}
#endif
void
ktwalk(struct tstate *ts, struct table *tp)