Source
zabbix_log(LOG_LEVEL_DEBUG, "append macro '%s'='%s' in cache", (char *)pair.first, (char *)pair.second);
/*
** 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.
**/
/******************************************************************************
* *
* Purpose: compare two macros by name *
* *
* Parameters: d1 - [IN] the first macro *
* d2 - [IN] the second macro *
* *
* Return value: <0 - the first macro name is 'less' than second *
* 0 - the macro names are equal *
* >0 - the first macro name is 'greater' than second *
* *
******************************************************************************/
static int httpmacro_cmp_func(const void *d1, const void *d2)
{
const zbx_ptr_pair_t *pair1 = (const zbx_ptr_pair_t *)d1;
const zbx_ptr_pair_t *pair2 = (const zbx_ptr_pair_t *)d2;
return strcmp((char *)pair1->first, (char *)pair2->first);
}
/******************************************************************************
* *
* Purpose: appends key/value pair to the http test macro cache. *
* If the value format is 'regex:<pattern>', then regular expression *
* match is performed against the supplied data value and specified *
* pattern. The first captured group is assigned to the macro value. *
* *
* Parameters: httptest - [IN/OUT] the http test data *
* pkey - [IN] a pointer to the macro name (key) data *
* nkey - [IN] the macro name (key) size *
* pvalue - [IN] a pointer to the macro value data *
* nvalue - [IN] the value size *
* data - [IN] the data for regexp matching (optional) *
* err_str - [OUT] the error message (optional) *
* *