Return TypeFunction nameArguments
hzString&hzString::DelWhiteLead(void)

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

Function Logic:

0:START 1:!m_addr 2:Return *this 3:_strXlate thisCtl hzString::Length nLen _strItem::_data i count wc 4:count 5:i[count]<=(char)32 6:items 7:!wc 8:Return *this 9:nusize 10:nusize<=0 11:hzString::Clear 12:Return *this 13:_strAlloc destAddr 14:!destAddr 15:hzexit 16:_strXlate destCtl _strItem::_setSize _strItem::_data _strItem::_data memcpy destCtl 17:thisCtl->m_copy&&thisCtl->m_copy<50 18:!_hzGlobal_MT 19:items 20:!thisCtl->m_copy 21:_strItem::_getSize _strFree 22:__sync_add_and_fetch(&(thisCtl->m_copy),-1)==0 23:_strItem::_getSize _strFree 24:m_addr 25:Return *this

Function body:

hzString& hzString::DelWhiteLead (void)
{
   _hzfunc("hzString::DelWhiteLead") ;
   _strItem*       thisCtl ;
   _strItem*       destCtl ;
   const char*     i ;
   uint32_t        destAddr ;
   uint32_t        wc ;
   uint32_t        count ;
   uint32_t        nLen ;
   uint32_t        nusize ;
   if (!m_addr)
       return *this ;
   thisCtl = (_strItem*) _strXlate(m_addr) ;
   nLen = Length() ;
   i = (char*) thisCtl->_data() ;
   for (wc = count = 0; count < nLen ; count++)
   {
       if (i[count] <&eq; CHAR_SPACE)
           wc++ ;
       else
           break ;
   }
   if (!wc)
       return *this ;
   nusize = nLen - wc ;
   if (nusize <&eq; 0)
   {
       Clear() ;
       return *this ;
   }
   destAddr = _strAlloc(nusize) ;
   if (!destAddr)
       hzexit(E_MEMORY, "Buffer of (%d) bytes", nusize) ;
   destCtl = (_strItem*) _strXlate(destAddr) ;
   destCtl->_setSize(nusize) ;
   memcpy(destCtl->_data(), thisCtl->_data() + wc, nusize) ;
   destCtl->m_copy = 1;
   if (thisCtl->m_copy && thisCtl->m_copy < 50)
   {
       if (!_hzGlobal_MT)
       {
           thisCtl->m_copy-- ;
           if (!thisCtl->m_copy)
               _strFree(m_addr, thisCtl->_getSize()) ;
       }
       else
       {
           if (__sync_add_and_fetch(&(thisCtl->m_copy), -1)== 0)
               _strFree(m_addr, thisCtl->_getSize()) ;
       }
   }
   m_addr = destAddr ;
   return *this ;
}