/* ** This function frees all resources held by the Database structure passed ** as the only argument. */ static void freeDatabase(lsm_env *pEnv, Database *p){ if( p ){ /* Free the mutexes */ lsmMutexDel(pEnv, p->pClientMutex); lsmMutexDel(pEnv, p->pWorkerMutex); /* Free the log buffer. */ lsmStringClear(&p->log.buf); /* Free the memory allocated for the Database struct itself */ lsmFree(pEnv, p); } }
void lsmLogMessage(lsm_db *pDb, int rc, const char *zFormat, ...){ if( pDb->xLog ){ LsmString s; va_list ap, ap2; lsmStringInit(&s, pDb->pEnv); va_start(ap, zFormat); va_start(ap2, zFormat); lsmStringVAppendf(&s, zFormat, ap, ap2); va_end(ap); va_end(ap2); pDb->xLog(pDb->pLogCtx, rc, s.z); lsmStringClear(&s); } }