zabbix-agent2/src/libs/zbxdbcache/dbconfig.c
/******************************************************************************
 *                                                                            *
 * Function: DCconfig_update_inventory_values                                 *
 *                                                                            *
 * Purpose: update automatic inventory in configuration cache                 *
 *                                                                            *
 ******************************************************************************/
DCconfig_update_inventory_values

Purpose: update automatic inventory in configuration cache
DCconfig_update_inventory_values Purpose : update automatic inventory in configuration cache
void	DCconfig_update_inventory_values(const zbx_vector_ptr_t *inventory_values)
{
	ZBX_DC_HOST_INVENTORY	*host_inventory = NULL;
	int			i;
	WRLOCK_CACHE;
	for (i = 0; i < inventory_values->values_num; i++)
	{
		const zbx_inventory_value_t	*inventory_value = (zbx_inventory_value_t *)inventory_values->values[i];
		const char			**value;
		if (NULL == host_inventory || inventory_value->hostid != host_inventory->hostid)
		{
			host_inventory = (ZBX_DC_HOST_INVENTORY *)zbx_hashset_search(&config->host_inventories_auto, &inventory_value->hostid);
			if (NULL == host_inventory)
				continue;
		}
		value = &host_inventory->values[inventory_value->idx];
		DCstrpool_replace((NULL != *value ? 1 : 0), value, inventory_value->value);
	}
	UNLOCK_CACHE;
}
void DCconfig_update_inventory_values ( const zbx_vector_ptr_t * inventory_values ) { ZBX_DC_HOST_INVENTORY * host_inventory = NULL ; int i ; WRLOCK_CACHE ; for ( i = 0 ; i < inventory_values -> values_num ; i ++ ) { const zbx_inventory_value_t * inventory_value = ( zbx_inventory_value_t * ) inventory_values -> values [ i ] ; const char * * value ; if ( NULL == host_inventory || inventory_value -> hostid != host_inventory -> hostid ) { host_inventory = ( ZBX_DC_HOST_INVENTORY * ) zbx_hashset_search ( & config -> host_inventories_auto , & inventory_value -> hostid ) ; if ( NULL == host_inventory ) continue ; } value = & host_inventory -> values [ inventory_value -> idx ] ; DCstrpool_replace ( ( NULL != * value ? 1 : 0 ) , value , inventory_value -> value ) ; } UNLOCK_CACHE ; }
Function: DCconfig_update_inventory_values                                 
                                                                            
 Purpose: update automatic inventory in configuration cache
Function : DCconfig_update_inventory_values Purpose : update automatic inventory in configuration cache