Return TypeFunction nameArguments
voidhzXbuf::Clear(void)

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

Function Logic:

0:START 1:!mx 2: No text 3:cx mx 4:_hzGlobal_MT 5:__sync_add_and_fetch 6:cx->m_copy 7: No text 8:items 9:cx->m_copy 10: No text 11:cx->m_Begin 12:hzLockRWD::LockWrite 13:!cx->m_End 14:hzexit 15:zp _xblk::Next s_xblk_free cx cx cx count 16:cx->m_nSize%XBLKSIZE 17:items 18:_hzGlobal_Memstats hzLockRWD::Unlock 19:cx 20: No text

Function body:

void hzXbuf::Clear (void)
{
   _hzfunc("hzXbuf::Clear") ;
   _xbuf*      cx ;
   _xblk*      zp ;
   uint32_t    count ;
   if (!mx)
       return ;
   cx = mx ;
   mx = 0;
    if (_hzGlobal_MT)
    {
        __sync_add_and_fetch((uint32_t*)&(cx->m_copy), -1);
        if (cx->m_copy)
           return ;
    }
    else
    {
        cx->m_copy-- ;
        if (cx->m_copy)
           return ;
    }
   if (cx->m_Begin)
   {
       s_xbuf_mutex.LockWrite() ;
           if (!cx->m_End)
               hzexit(E_CORRUPT, "The internal begin/end blocks are %p and %p", cx->m_Begin, cx->m_End) ;
           zp = (_xblk*) cx->m_End ;
           zp->Next(s_xblk_free) ;
           s_xblk_free = (_xblk*) cx->m_Begin ;
           cx->m_Begin = cx->m_End = 0;
           cx->m_nSize = 0;
           count = cx->m_nSize / XBLKSIZE ;
           if (cx->m_nSize % XBLKSIZE)
               count++ ;
           _hzGlobal_Memstats.m_numChainBF += count ;
       s_xbuf_mutex.Unlock() ;
   }
   delete cx ;
}