zabbix-agent2/src/libs/zbxeval/misc.c
/******************************************************************************
 *                                                                            *
 * Function: zbx_eval_get_functionids_ordered                                 *
 *                                                                            *
 * Purpose: get functionids from parsed expression in the order they are      *
 *          written                                                           *
 *                                                                            *
 * Parameters: ctx         - [IN] the evaluation context                      *
 *             functionids - [OUT] the extracted functionids                  *
 *                                                                            *
 ******************************************************************************/
zbx_eval_get_functionids_ordered

Purpose: get functionids from parsed expression in the order they are
written

Parameters: ctx         - [IN] the evaluation context
functionids - [OUT] the extracted functionids
zbx_eval_get_functionids_ordered Purpose : get functionids from parsed expression in the order they are written Parameters : ctx - [ IN ] the evaluation context functionids - [ OUT ] the extracted functionids
void	zbx_eval_get_functionids_ordered(zbx_eval_context_t *ctx, zbx_vector_uint64_t *functionids)
{
	int			i;
	zbx_vector_ptr_t	tokens;
	zbx_vector_ptr_create(&tokens);
	for (i = 0; i < ctx->stack.values_num; i++)
	{
		if (ZBX_EVAL_TOKEN_FUNCTIONID == ctx->stack.values[i].type)
			zbx_vector_ptr_append(&tokens, &ctx->stack.values[i]);
	}
	zbx_vector_ptr_sort(&tokens, compare_tokens_by_loc);
	for (i = 0; i < tokens.values_num; i++)
	{
		zbx_eval_token_t	*token = (zbx_eval_token_t *)tokens.values[i];
		zbx_uint64_t		functionid;
		if (SUCCEED == expression_extract_functionid(ctx->expression, token, &functionid))
			zbx_vector_uint64_append(functionids, functionid);
	}
	zbx_vector_ptr_destroy(&tokens);
}
void zbx_eval_get_functionids_ordered ( zbx_eval_context_t * ctx , zbx_vector_uint64_t * functionids ) { int i ; zbx_vector_ptr_t tokens ; zbx_vector_ptr_create ( & tokens ) ; for ( i = 0 ; i < ctx -> stack . values_num ; i ++ ) { if ( ZBX_EVAL_TOKEN_FUNCTIONID == ctx -> stack . values [ i ] . type ) zbx_vector_ptr_append ( & tokens , & ctx -> stack . values [ i ] ) ; } zbx_vector_ptr_sort ( & tokens , compare_tokens_by_loc ) ; for ( i = 0 ; i < tokens . values_num ; i ++ ) { zbx_eval_token_t * token = ( zbx_eval_token_t * ) tokens . values [ i ] ; zbx_uint64_t functionid ; if ( SUCCEED == expression_extract_functionid ( ctx -> expression , token , & functionid ) ) zbx_vector_uint64_append ( functionids , functionid ) ; } zbx_vector_ptr_destroy ( & tokens ) ; }
Function: zbx_eval_get_functionids_ordered                                 
                                                                            
 Purpose: get functionids from parsed expression in the order they are      
          written                                                           
                                                                            
 Parameters: ctx         - [IN] the evaluation context                      
             functionids - [OUT] the extracted functionids
Function : zbx_eval_get_functionids_ordered Purpose : get functionids from parsed expression in the order they are written Parameters : ctx - [ IN ] the evaluation context functionids - [ OUT ] the extracted functionids