Source
int zbx_count_var_vector_with_pattern(zbx_eval_count_pattern_data_t *pdata, char *pattern, zbx_vector_var_t *values,
/*
** Copyright (C) 2001-2025 Zabbix SIA
**
** This program is free software: you can redistribute it and/or modify it under the terms of
** the GNU Affero General Public License as published by the Free Software Foundation, version 3.
**
** This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
** without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
** See the GNU Affero General Public License for more details.
**
** You should have received a copy of the GNU Affero General Public License along with this program.
** If not, see <https://www.gnu.org/licenses/>.
**/
static zbx_get_expressions_by_name_f get_expressions_by_name_cb = NULL;
void zbx_init_library_eval(zbx_get_expressions_by_name_f get_expressions_by_name_func)
{
get_expressions_by_name_cb = get_expressions_by_name_func;
}
static void count_one_ui64(int *count, int op, zbx_uint64_t value, zbx_uint64_t pattern, zbx_uint64_t mask)
{
switch (op)
{
case OP_EQ:
if (value == pattern)
(*count)++;
break;
case OP_NE:
if (value != pattern)
(*count)++;
break;
case OP_GT:
if (value > pattern)
(*count)++;
break;
case OP_GE:
if (value >= pattern)
(*count)++;
break;
case OP_LT:
if (value < pattern)
(*count)++;
break;
case OP_LE:
if (value <= pattern)
(*count)++;
break;
case OP_BITAND:
if ((value & mask) == pattern)
(*count)++;
}
}
static void count_one_dbl(int *count, int op, double value, double pattern)