Source
if (SUCCEED != zbx_eval_parse_expression(&ctx, zbx_mock_get_parameter_string("in.expression"), rules, &error))
/*
** Zabbix
** Copyright (C) 2001-2023 Zabbix SIA
**
** This program is free software; you can redistribute it and/or modify
** it under the terms of the GNU General Public License as published by
** the Free Software Foundation; either version 2 of the License, or
** (at your option) any later version.
**
** 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 General Public License for more details.
**
** You should have received a copy of the GNU General Public License
** along with this program; if not, write to the Free Software
** Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
**/
typedef struct
{
const char *name;
int args_num;
zbx_variant_t retval;
const char *error;
}
zbx_mock_callback_t;
zbx_vector_ptr_t callbacks;
static void mock_callback_free(zbx_mock_callback_t *cb)
{
zbx_variant_clear(&cb->retval);
zbx_free(cb);
}
static void mock_read_callbacks(const char *path)
{
zbx_mock_handle_t hcbs, hcb, hdata, hvalue;
zbx_mock_error_t err;
if (ZBX_MOCK_SUCCESS != zbx_mock_parameter(path, &hcbs))
return;
while (ZBX_MOCK_END_OF_VECTOR != (err = (zbx_mock_vector_element(hcbs, &hcb))))
{
zbx_mock_callback_t *cb;
const char *value;
if (ZBX_MOCK_SUCCESS != err)
fail_msg("cannot read callback contents");
cb = (zbx_mock_callback_t *)zbx_malloc(NULL, sizeof(zbx_mock_callback_t));
memset(cb, 0, sizeof(zbx_mock_callback_t));