Allocate a temporary char* buffer from the per-thread scratch pad. Scratch pad allocations do not require deconstruction as they are eventually overwritten by subsequent scratch-pad allocations. This allows functions to use char* automatic variables to return string values to the caller, in string space that is not deleted on return of the function - without requiring the caller to delete the space. A common use of this technique, is where a printf-type function calls other functions during argument processing. The scratch pad is 16K and imposes a limit of 2K on individual allocations. With the proviso that the applicable thread has a hzProcess instance associated with it (nothing much will work otherwise), and with the proviso that the request for 2K or less, this allocation function will always succeed.

Return TypeFunction nameArguments
char*hzProcess::ScratchPad(int32_t,)

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

Function Logic:

0:START 1:unknown 2:Return 0 3:unknown 4:Return 0 5:m_nScratchAdvn m_nScratchOset 6:unknown 7:m_nScratchAdvn m_nScratchOset 8:Return m_Scratch+m_nScratchAdvn

Function body:

char* hzProcess::ScratchPad (int32_t nSize)
{
   //  Allocate a temporary char* buffer from the per-thread scratch pad.
   //  
   //  Scratch pad allocations do not require deconstruction as they are eventually overwritten by subsequent scratch-pad allocations. This allows functions to use char* automatic
   //  variables to return string values to the caller, in string space that is not deleted on return of the function - without requiring the caller to delete the space. A common
   //  use of this technique, is where a printf-type function calls other functions during argument processing.
   //  
   //  The scratch pad is 16K and imposes a limit of 2K on individual allocations. With the proviso that the applicable thread has a hzProcess instance associated with it (nothing
   //  much will work otherwise), and with the proviso that the request for 2K or less, this allocation function will always succeed.
   if (!this)
       return 0;
   if (nSize > 2048)
       return 0;
   //  {
   //  hzerr(E_RANGE, "Oversized scratch allocation") ;
   //  return new char[nSize] ;
   //  }
   m_nScratchAdvn = m_nScratchOset ;
   m_nScratchOset += nSize ;
   if (m_nScratchOset >&eq; 16380)
   {
       m_nScratchAdvn = 0;
       m_nScratchOset = nSize ;
   }
   return m_Scratch + m_nScratchAdvn ;
}