- if (!--t->c) {
- unsigned long m = t->mask + 1; /* Next set bit in has word */
- sym_base *p, *q, *r; /* More useful pointers */
- size_t i, lim; /* Loop counter and limit */
-
- TRACK_CTX("symbol table extension");
- TRACK_PUSH;
-
- /* --- Update values in the anchor block --- */
-
- TRY {
- t->a = xrealloc(t->a, (t->mask + 1) * 2 * sizeof(sym_base *));
- } CATCH switch (exc_type) {
- case EXC_NOMEM:
- TRACK_POP;
- return (p);
- default:
- TRACK_POP;
- RETHROW;
- } END_TRY;
-
- t->c = SYM_LIMIT(t->mask + 1); /* Set load value */
- t->mask = (t->mask + 1) * 2 - 1; /* Set the new mask value */
-
- /* --- Now wander through the table rehashing things --- *
- *
- * This loop is very careful to avoid problems with aliasing. The items
- * are dealt with from the end backwards to avoid overwriting bins before
- * they've been processed.
- */
-
- lim = (t->mask + 1) >> 1;
- for (i = 0; i < lim; i++) {
-
- /* --- Some initialisation --- */
-
- r = t->a[i]; /* Find the list we're dissecting */
- p = (sym_base *)(t->a + i); /* Find bit-clear list */
- q = (sym_base *)(t->a + i + lim); /* And the bit-set lsit */
-
- /* --- Now go through the @r@ list --- */
-
- while (r) {
- if (r->hash & m) /* Is the next bit set? */
- q = q->next = r; /* Yes, so fit up previous link */
- else
- p = p->next = r; /* No, so fit up previous link */
- r = r->next; /* Move onto the next item */
- }
- p->next = q->next = 0; /* Null terminate the new lists */
- }
-
- TRACK_POP;
- }