Return TypeFunction nameArguments
hzEcodehzSSR::Free(unsigned int,unsigned int,)

Declared in file: hzSSR.h
Defined in file : hzSSR.cpp

Function Logic:

0:START 1:items 2:!strAddr||!nSize 3:!strAddr 4:!nSize 5:Return E_OK 6:hzSSR::Xlate pSlot 7:!pSlot 8:Return hzerr(E_CORRUPT,WARNING freeing invalid obj %u:%u of size %u bytes\n,(strAddr&0xffff0000)>>16,strAddr&0xffff,nSize) 9:pSlot->m_Blank[0]==0xff 10:Return hzerr(E_CORRUPT,WARNING already deleted obj %u:%u of size %u bytes\n,(strAddr&0xffff0000)>>16,strAddr&0xffff,nSize) 11:nUnit 12:_hzGlobal_MT 13:hzLockRWD::LockWrite 14:pSlot pSlot m_flistItem items items 15:_hzGlobal_MT 16:hzLockRWD::Unlock 17:Return E_OK

Function body:

hzEcode hzSSR::Free (unsigned int strAddr, unsigned int nSize)
{
   _hzfunc("hzSSR::Free") ;
   static  uint32_t    _noCalls = 0;
   _ssrFLE*    pSlot ;
   uint32_t    nUnit ;
   _noCalls++ ;
   if (!strAddr || !nSize)
   {
       if (!strAddr)   threadLog("Warning: Cannot delete null item\n") ;
       if (!nSize)     threadLog("Warning: Cannot delete zero size item\n") ;
       return E_OK ;
   }
   pSlot = (_ssrFLE*) Xlate(strAddr) ;
   if (!pSlot)
       return hzerr(E_CORRUPT, "WARNING freeing invalid obj %u:%u of size %u bytes\n", (strAddr & 0xffff0000)>>16,strAddr&0xffff,nSize);
   if (pSlot->m_Blank[0]== 0xff)
       return hzerr(E_CORRUPT, "WARNING already deleted obj %u:%u of size %u bytes\n", (strAddr & 0xffff0000)>>16,strAddr&0xffff,nSize);
   nUnit = (nSize/8)+ (nSize%8? 1:0);
   /*
   **  if (pBloc->m_Alloc[slotNo] != (nSize-1))
   **   {
   **    threadLog("TEST: CORRUPT: Address %u:%u has size %u, not %u\n", blkNo, slotNo, pBloc->m_Alloc[slotNo]+1, nSize) ;
   **    threadLog("Bad string address %u:%u (nocalls %u)\n", (strAddr&0x7fff0000)>>16, strAddr&0xffff, _noCalls) ;
   **    threadLog("Str value approx is [%s]\n", pItem->m_data + 3) ;
   **    return E_CORRUPT ;
   **   }
   **      */
   if (_hzGlobal_MT)
       m_lockItem[nUnit-1].LockWrite();
   pSlot->m_Blank[0]= 0xff;
   pSlot->m_fleNext = m_flistItem[nUnit-1];
   m_flistItem[nUnit-1]= strAddr ;
   m_flistPopl[nUnit-1]++;
   m_nReleases++ ;
   if (_hzGlobal_MT)
       m_lockItem[nUnit-1].Unlock();
   return E_OK ;
}