Lines Matching defs:tab

130  * insert prefix range min..max into tab
135 ptvinsert(Ptv_t* tab, Ptvaddr_t min, Ptvaddr_t max)
141 tab->entries++;
142 fvset(tab->size, tab->r[2], 1);
143 if (fvcmp(tab->size, min, tab->r[2]) >= 0)
145 fvsub(tab->size, tab->r[3], min, tab->r[2]);
146 key.min = key.max = tab->r[3];
150 if (!(xp = (Ptvprefix_t*)dtsearch(tab->dict, &key)))
151 xp = (Ptvprefix_t*)dtnext(tab->dict, &key);
157 if (fvcmp(tab->size, key.min, xp->min) >= 0 && fvcmp(tab->size, key.max, xp->max) <= 0)
159 if (fvcmp(tab->size, xp->min, tab->r[2]) >= 0)
160 fvsub(tab->size, tab->r[3], xp->min, tab->r[2]);
162 fvset(tab->size, tab->r[3], 0);
163 if (fvcmp(tab->size, key.max, tab->r[3]) >= 0)
165 if (fvcmp(tab->size, key.min, xp->min) > 0)
171 xp = (Ptvprefix_t*)dtnext(tab->dict, xp);
172 dtdelete(tab->dict, pp);
175 fvsub(tab->size, tab->r[3], xp->min, tab->r[1]);
176 } while (fvcmp(tab->size, key.max, tab->r[3]) >= 0);
177 if (fvcmp(tab->size, key.max, max) < 0)
181 return (Ptvprefix_t*)dtinsert(tab->dict, &key);
185 * delete prefix range min..max from tab
190 ptvdelete(Ptv_t* tab, Ptvaddr_t min, Ptvaddr_t max)
196 tab->entries++;
199 if (xp = (Ptvprefix_t*)dtsearch(tab->dict, &key))
201 fvset(tab->size, tab->r[1], 1);
206 dtdelete(tab->dict, xp);
207 if (fvcmp(tab->size, key.min, cur.min) > 0)
210 fvsub(tab->size, tab->r[0], key.min, tab->r[1]);
211 cur.max = tab->r[0];
212 if (!dtinsert(tab->dict, &cur))
214 if (fvcmp(tab->size, key.max, max) < 0)
216 fvadd(tab->size, tab->r[2], key.max, tab->r[1]);
217 cur.min = tab->r[2];
219 if (!dtinsert(tab->dict, &cur))
224 else if (fvcmp(tab->size, key.max, xp->max) < 0)
226 fvadd(tab->size, tab->r[3], key.max, tab->r[1]);
227 xp->min = tab->r[3];
228 if (!dtinsert(tab->dict, xp))
231 } while (xp = (Ptvprefix_t*)dtnext(tab->dict, xp));
235 if (tab->disc->errorf)
236 (*tab->disc->errorf)(NiL, tab->disc, ERROR_SYSTEM|2, "out of space");