Lines Matching refs:tp

17 static void     texpand     ARGS((struct table *tp, int nsize));
33 tinit(tp, ap, tsize) in tinit() argument
34 struct table *tp; in tinit()
38 tp->areap = ap;
39 tp->tbls = NULL;
40 tp->size = tp->nfree = 0;
42 texpand(tp, tsize);
46 texpand(tp, nsize) in texpand() argument
47 struct table *tp; in texpand()
52 struct tbl **ntblp, **otblp = tp->tbls;
53 int osize = tp->size;
55 ntblp = (struct tbl**) alloc(sizeofN(struct tbl *, nsize), tp->areap);
58 tp->size = nsize;
59 tp->nfree = 8*nsize/10; /* table can get 80% full */
60 tp->tbls = ntblp;
67 & (tp->size-1)];
70 p += tp->size;
72 tp->nfree--;
74 afree((void*)tblp, tp->areap);
78 afree((void*)otblp, tp->areap);
82 mytsearch(tp, n, h) in mytsearch() argument
83 struct table *tp; /* table */ in mytsearch()
89 if (tp->size == 0)
93 for (pp = &tp->tbls[h & (tp->size-1)]; (p = *pp) != NULL; pp--) {
97 if (pp == tp->tbls) /* wrap */
98 pp += tp->size;
105 tenter(tp, n, h) in tenter() argument
106 struct table *tp; /* table */ in tenter()
113 if (tp->size == 0)
114 texpand(tp, INIT_TBLS);
117 for (pp = &tp->tbls[h & (tp->size-1)]; (p = *pp) != NULL; pp--) {
120 if (pp == tp->tbls) /* wrap */
121 pp += tp->size;
124 if (tp->nfree <= 0) { /* too full */
125 texpand(tp, 2*tp->size);
132 tp->areap);
135 p->areap = tp->areap;
141 tp->nfree--;
154 ksh_twalk(ts, tp) in ksh_twalk() argument
156 struct table *tp;
158 ts->left = tp->size;
159 ts->next = tp->tbls;
182 tsort(tp) in tsort() argument
183 struct table *tp; in tsort()
188 p = (struct tbl **)alloc(sizeofN(struct tbl *, tp->size+1), ATEMP);
189 sp = tp->tbls; /* source */
191 for (i = 0; i < tp->size; i++)
203 void tprintinfo ARGS((struct table *tp));
206 tprintinfo(tp) in tprintinfo() argument
207 struct table *tp; in tprintinfo()
217 shellf("table size %d, nfree %d\n", tp->size, tp->nfree);
219 ksh_twalk(&ts, tp);
227 for (pp = &tp->tbls[h & (tp->size-1)]; (p = *pp); pp--) {
232 if (pp == tp->tbls) /* wrap */
233 pp += tp->size;