zabbix-agent2/src/libs/zbxtrends/cache.c
/******************************************************************************
 *                                                                            *
 * Function: tfc_malloc_func                                                  *
 *                                                                            *
 * Purpose: allocate memory for indexing hashset                              *
 *                                                                            *
 * Comments: There are two kinds of allocations that should be done:          *
 *             1) initial allocation of hashset slots array                   *
 *             2) allocations of hashset entries                              *
 *           The initial hashset size is chosen large enough to hold all      *
 *           entries without reallocation. So there should be no other        *
 *           allocations done.                                                *
 *                                                                            *
 ******************************************************************************/
tfc_malloc_func

Purpose: allocate memory for indexing hashset

Comments: There are two kinds of allocations that should be done:
1) initial allocation of hashset slots array
2) allocations of hashset entries
The initial hashset size is chosen large enough to hold all
entries without reallocation. So there should be no other
allocations done.
tfc_malloc_func Purpose : allocate memory for indexing hashset Comments : There are two kinds of allocations that should be done : 1 ) initial allocation of hashset slots array 2 ) allocations of hashset entries The initial hashset size is chosen large enough to hold all entries without reallocation . So there should be no other allocations done .
static void	*tfc_malloc_func(void *old, size_t size)
{
	if (sizeof(zbx_tfc_slot_t) == size)
		return tfc_alloc_slot();
	if (0 == alloc_num++)
		return __tfc_mem_malloc_func(old, size);
	return NULL;
}
static void * tfc_malloc_func ( void * old , size_t size ) { if ( sizeof ( zbx_tfc_slot_t ) == size ) return tfc_alloc_slot ( ) ; if ( 0 == alloc_num ++ ) return __tfc_mem_malloc_func ( old , size ) ; return NULL ; }
Function: tfc_malloc_func                                                  
                                                                            
 Purpose: allocate memory for indexing hashset                              
                                                                            
 Comments: There are two kinds of allocations that should be done:          
             1) initial allocation of hashset slots array                   
             2) allocations of hashset entries                              
           The initial hashset size is chosen large enough to hold all      
           entries without reallocation.
Function : tfc_malloc_func Purpose : allocate memory for indexing hashset Comments : There are two kinds of allocations that should be done : 1 ) initial allocation of hashset slots array 2 ) allocations of hashset entries The initial hashset size is chosen large enough to hold all entries without reallocation .