static void gfFileCacheFreeEl(struct hashEl *el) /* Free up one file cache info. */ { char *name = el->name; if (nibIsFile(name)) { struct nibInfo *nib = el->val; nibInfoFree(&nib); } else { struct twoBitFile *tbf = el->val; twoBitClose(&tbf); } el->val = NULL; }
void nibTwoCacheFree(struct nibTwoCache **pNtc) /* Free up resources associated with nibTwoCache. */ { struct nibTwoCache *ntc = *pNtc; if (ntc != NULL) { freez(&ntc->pathName); if (ntc->isTwoBit) twoBitClose(&ntc->tbf); else { struct hashEl *el, *list = hashElListHash(ntc->nibHash); struct nibInfo *nib; for (el = list; el != NULL; el = el->next) { nib = el->val; nibInfoFree(&nib); } hashElFreeList(&list); hashFree(&ntc->nibHash); } freez(pNtc); } }