- DBG("GARY: Resize to %zd elements (need %zd)", h->have_space, n);
- return xrealloc(h, GARY_HDR_SIZE + h->have_space * h->elt_size);
+ DBG("GARY: Resize from %zd to %zd elements (need %zd)", old_size, h->have_space, n);
+ h = xrealloc(h, GARY_HDR_SIZE + h->have_space * h->elt_size);
+ if (h->zeroed)
+ bzero(GARY_BODY(h) + h->elt_size * old_size, h->elt_size * (h->have_space - old_size));
+ return h;