void *needLargeZeroedMemResize(void* vp, size_t oldSize, size_t newSize) /* Adjust memory size on a block, possibly relocating it. If vp is NULL, a * new memory block is allocated. If block is grown, new memory is zeroed. */ { void *v = needLargeMemResize(vp, newSize); if (newSize > oldSize) memset(((char*)v)+oldSize, 0, newSize-oldSize); return v; }
static UBYTE *clearBaseArray(struct cDnaAlign *aln) /* get cleared per-base array, growing if needed. Warning: this static */ { static UBYTE *bases = NULL; static unsigned maxBases = 0; if (aln->psl->qSize > maxBases) { maxBases = 2*aln->psl->qSize; bases = needLargeMemResize(bases, maxBases); } zeroBytes(bases, maxBases); return bases; }