register HE **b;
register HE *entry;
register HE **oentry;
-#ifndef STRANGE_MALLOC
- I32 tmp;
-#endif
nomemok = TRUE;
#if defined(STRANGE_MALLOC) || defined(MYMALLOC)
return;
}
#else
- i = newsize * sizeof(HE*);
#define MALLOC_OVERHEAD 16
- tmp = MALLOC_OVERHEAD;
- while (tmp - MALLOC_OVERHEAD < i)
- tmp += tmp;
- tmp -= MALLOC_OVERHEAD;
- tmp /= sizeof(HE*);
- assert(tmp >= newsize);
- New(2,a, tmp, HE*);
+ New(2, a, newsize*sizeof(HE*) * 2 - MALLOC_OVERHEAD, char);
if (!a) {
nomemok = FALSE;
return;
return;
}
#else
- i = newsize * sizeof(HE*);
- j = MALLOC_OVERHEAD;
- while (j - MALLOC_OVERHEAD < i)
- j += j;
- j -= MALLOC_OVERHEAD;
- j /= sizeof(HE*);
- assert(j >= newsize);
- New(2, a, j, HE*);
+ New(2, a, newsize * sizeof(HE*) * 2 - MALLOC_OVERHEAD, char);
if (!a) {
nomemok = FALSE;
return;
Zero(&a[oldsize], newsize-oldsize, HE*); /* zero 2nd half*/
}
else {
+#if defined(STRANGE_MALLOC) || defined(MYMALLOC)
Newz(0, a, newsize, HE*);
+#else
+ Newz(0, a, newsize * sizeof(HE*) * 2 - MALLOC_OVERHEAD, char);
+#endif
}
xhv->xhv_max = --newsize;
xhv->xhv_array = (char*)a;