69424fe5a90aff4e1d8fc3f7c92611c837116e71 tdreszer Tue Feb 5 16:25:42 2013 -0800 Dropped lmFlushZ function at Angie's request. It added little value over lmCleanup/lmInit. diff --git src/lib/localmem.c src/lib/localmem.c index ff29a7e..c6fdaa4 100644 --- src/lib/localmem.c +++ src/lib/localmem.c @@ -62,42 +62,30 @@ newBlock(lm, blockSize); return lm; } void lmCleanup(struct lm **pLm) /* Clean up a local memory pool. */ { struct lm *lm = *pLm; if (lm == NULL) return; slFreeList(&lm->blocks); freeMem(lm); *pLm = NULL; } -int lmFlushZ(struct lm *lm) -// Zero's and makes available most recent block of pool, abandoning older blocks -// USE WITH CAUTION: All previous pointers into lm will be invalid -{ -slFreeList(&(lm->blocks->next)); // free any extra blocks -struct lmBlock *mb = lm->blocks; -mb->free = (char *)(mb+1); -size_t fullSize = (mb->end - mb->free); -memset(mb->free,0,fullSize); -return fullSize; -} - size_t lmAvailable(struct lm *lm) // Returns currently available memory in pool { struct lmBlock *mb = lm->blocks; return (mb->end - mb->free); } size_t lmSize(struct lm *lm) // Returns current size of pool, even for memory already allocated { size_t fullSize = 0; struct lmBlock *mb = lm->blocks; for (;mb != NULL;mb = mb->next) fullSize += (mb->end - (char *)(mb+1));