void CTLSStorageInstance::Finit()
{
	CTLSStorageArray *psaStorageArrayList = GetStorageArrayList();

	if (psaStorageArrayList)
	{
		FreeStorageArrayList(psaStorageArrayList);

		bool bListClearingResult = TrySettingStorageArrayList(NULL, psaStorageArrayList); // It could be assigned directly, but I just do not want to add an extra method
		OU_VERIFY(bListClearingResult);
	}

	if (GetStorageKeyValidFlag())
	{
		const HTLSKEYVALUE &hkvStorageKey = GetStorageKey();
		FreeStorageKey(hkvStorageKey);

		ResetStorageKeyValidFlag();
	}
}
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;
}
示例#3
0
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;
}