static VOID VmDirPagedSearchCacheRecordFree( PVDIR_PAGED_SEARCH_RECORD pSearchRecord ) { PVOID pvData = NULL; BOOLEAN bInLock = FALSE; if (pSearchRecord == NULL) { return; } VMDIR_LOCK_MUTEX(bInLock, gPagedSearchCache.mutex); (VOID)LwRtlHashTableRemove(gPagedSearchCache.pHashTbl, &pSearchRecord->Node); VMDIR_UNLOCK_MUTEX(bInLock, gPagedSearchCache.mutex); VmDirFreeStringA(pSearchRecord->pszGuid); DeleteFilter(pSearchRecord->pFilter); while (dequePop(pSearchRecord->pQueue, (PVOID*)&pvData) == 0) { VmDirFreeMemory(pvData); } dequeFree(pSearchRecord->pQueue); VmDirFreeMutex(pSearchRecord->mutex); VmDirFreeCondition(pSearchRecord->pDataAvailable); VmDirSrvThrFree(pSearchRecord->pThreadInfo); VmDirFreeMemory(pSearchRecord); }
void _dequeSetCap(deque_p d, int newCap) { int i, j; deque_p temp = dequeInit(newCap); for(i = 0, j = d->beg; i < d->size; i++, j++) { temp->data[i] = d->data[j]; if(j >= d->cap) j = -1; } temp->cap = newCap; temp->beg = 0; temp->size = d->size; dequeFree(d); d = temp; }
VOID TestDequeCode( PVMDIR_TEST_STATE pState ) { DWORD dwError = 0; PDEQUE pDeque = NULL; printf("Testing deque code ..."); dwError = dequeCreate(&pDeque); TestAssertEquals(dwError, ERROR_SUCCESS); testEmpty(pState, pDeque); testQueue(pState, pDeque); testStack(pState, pDeque); testEmpty(pState, pDeque); dequeFree(pDeque); printf(" PASSED\n"); }