bool CTLSStorageInstance::FindFreeStorageBlock(CTLSStorageBlock *&psbOutStorageBlock) { bool bResult = false; do { if (!FindFreeStorageBlockInArrayList(psbOutStorageBlock)) { CTLSStorageArray *psaStorageArray = AllocateStorageArray(); if (!psaStorageArray) { break; } FindFreeStorageBlockFromArray(psbOutStorageBlock, psaStorageArray); // Must always succeed as array is not added to list yet AddStorageArrayToArrayList(psaStorageArray); } bResult = true; } while (false); return bResult; }
bool CTLSStorageInstance::Init(ESTORAGEINSTANCEKIND ikInstanceKind) { bool bResult = false; bool bKeyAllocationResult = false; HTLSKEYVALUE hkvStorageKey; do { if (!AllocateStorageKey(hkvStorageKey, ikInstanceKind)) { break; } bKeyAllocationResult = true; CTLSStorageArray *psaFirstStorageArray = AllocateStorageArray(); if (!psaFirstStorageArray) { break; } SetStorageKey(hkvStorageKey); SetStorageKeyValidFlag(); AddStorageArrayToArrayList(psaFirstStorageArray); bResult = true; } while (false); if (!bResult) { if (bKeyAllocationResult) { FreeStorageKey(hkvStorageKey); } } return bResult; }
bool CTLSStorageInstance::Init() { bool bResult = false; bool bKeyAllocationResult = false; HTLSKEY hskStorageKey; do { if (!AllocateStorageKey(hskStorageKey)) { break; } bKeyAllocationResult = true; CTLSStorageArray *psaFirstStorageArray = AllocateStorageArray(); if (!psaFirstStorageArray) { break; } SetStorageKey(hskStorageKey); SetStorageKeyValidFlag(); AddStorageArrayToArrayList(psaFirstStorageArray); bResult = true; } while (false); if (!bResult) { if (bKeyAllocationResult) { FreeStorageKey(hskStorageKey); } } return bResult; }