for now, until we really use kt*() otherwise, ifdef out tablep/hval
This commit is contained in:
parent
4ccdfc8508
commit
bb7a720a00
4
expr.c
4
expr.c
@ -22,7 +22,7 @@
|
||||
|
||||
#include "sh.h"
|
||||
|
||||
__RCSID("$MirOS: src/bin/mksh/expr.c,v 1.31 2009/08/28 20:30:55 tg Exp $");
|
||||
__RCSID("$MirOS: src/bin/mksh/expr.c,v 1.32 2009/08/28 20:38:41 tg Exp $");
|
||||
|
||||
/* The order of these enums is constrained by the order of opinfo[] */
|
||||
enum token {
|
||||
@ -608,8 +608,10 @@ tempvar(void)
|
||||
vp->flag = ISSET|INTEGER;
|
||||
vp->type = 0;
|
||||
vp->areap = ATEMP;
|
||||
#ifdef notyet_ktremove
|
||||
vp->tablep = NULL;
|
||||
vp->hval = 0;
|
||||
#endif
|
||||
vp->val.i = 0;
|
||||
vp->name[0] = '\0';
|
||||
return (vp);
|
||||
|
18
main.c
18
main.c
@ -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)
|
||||
|
9
sh.h
9
sh.h
@ -134,7 +134,7 @@
|
||||
#endif
|
||||
|
||||
#ifdef EXTERN
|
||||
__RCSID("$MirOS: src/bin/mksh/sh.h,v 1.328 2009/08/28 20:30:58 tg Exp $");
|
||||
__RCSID("$MirOS: src/bin/mksh/sh.h,v 1.329 2009/08/28 20:38:42 tg Exp $");
|
||||
#endif
|
||||
#define MKSH_VERSION "R39 2009/08/08"
|
||||
|
||||
@ -864,7 +864,9 @@ struct tbl { /* table item */
|
||||
struct tbl *array; /* array values */
|
||||
const char *fpath; /* temporary path to undef function */
|
||||
} u;
|
||||
#ifdef notyet_ktremove
|
||||
struct table *tablep; /* table we're ktenter'd in */
|
||||
#endif
|
||||
union {
|
||||
int field; /* field with for -L/-R/-Z */
|
||||
int errno_; /* CEXEC/CTALIAS */
|
||||
@ -872,7 +874,9 @@ struct tbl { /* table item */
|
||||
int type; /* command type (see below), base (if INTEGER),
|
||||
* or offset from val.s of value (if EXPORT) */
|
||||
Tflag flag; /* flags */
|
||||
#ifdef notyet_ktremove
|
||||
uint32_t hval; /* hash(name) */
|
||||
#endif
|
||||
uint32_t index; /* index for an array */
|
||||
char name[4]; /* name -- variable length */
|
||||
};
|
||||
@ -1544,7 +1548,8 @@ uint32_t hash(const char *);
|
||||
void ktinit(struct table *, Area *, size_t);
|
||||
struct tbl *ktsearch(struct table *, const char *, uint32_t);
|
||||
struct tbl *ktenter(struct table *, const char *, uint32_t);
|
||||
void ktdelete(struct tbl *);
|
||||
#define ktdelete(p) do { p->flag = 0; } while (/* CONSTCOND */ 0)
|
||||
void ktremove(struct tbl *);
|
||||
void ktwalk(struct tstate *, struct table *);
|
||||
struct tbl *ktnext(struct tstate *);
|
||||
struct tbl **ktsort(struct table *);
|
||||
|
4
var.c
4
var.c
@ -22,7 +22,7 @@
|
||||
|
||||
#include "sh.h"
|
||||
|
||||
__RCSID("$MirOS: src/bin/mksh/var.c,v 1.80 2009/08/28 20:30:59 tg Exp $");
|
||||
__RCSID("$MirOS: src/bin/mksh/var.c,v 1.81 2009/08/28 20:38:43 tg Exp $");
|
||||
|
||||
/*
|
||||
* Variables
|
||||
@ -1266,9 +1266,11 @@ arraysearch(struct tbl *vp, uint32_t val)
|
||||
new->areap = vp->areap;
|
||||
new->u2.field = vp->u2.field;
|
||||
new->index = val;
|
||||
#ifdef notyet_ktremove
|
||||
/* XXX array indices must not be ktdelete'd, for now */
|
||||
new->tablep = NULL;
|
||||
new->hval = vp->hval;
|
||||
#endif
|
||||
|
||||
if (curr != new) { /* not reusing old array entry */
|
||||
prev->u.array = new;
|
||||
|
Loading…
x
Reference in New Issue
Block a user