Source
int db_rename_macro(DB_RESULT result, const char *table, const char *pkey, zbx_field_len_t *fields, int fields_num,
/*
** 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.
**/
/* Function argument descriptors. */
/* Used in varargs list to describe following parameter mapping to old position. */
/* Terminated with ZBX_DBPATCH_ARG_NONE. */
/* For example: */
/* ..., ZBX_DBPATCH_ARG_NUM, 1, ZBX_DBPATCH_ARG_STR, 0, ZBX_DBPATCH_ARG_NONE) */
/* meaning first numeric parameter copied from second parameter */
/* second string parameter copied from first parameter */
typedef enum
{
ZBX_DBPATCH_ARG_NONE, /* terminating descriptor, must be put at the end of the list */
ZBX_DBPATCH_ARG_HIST, /* history period followed by sec/num (int) and timeshift (int) indexes */
ZBX_DBPATCH_ARG_TIME, /* time value followed by argument index (int) */
ZBX_DBPATCH_ARG_NUM, /* number value followed by argument index (int) */
ZBX_DBPATCH_ARG_STR, /* string value followed by argument index (int) */
ZBX_DBPATCH_ARG_TREND, /* trend period, followed by period (int) and timeshift (int) indexes */
ZBX_DBPATCH_ARG_CONST_STR, /* constant,fffffff followed by string (char *) value */
}
zbx_dbpatch_arg_t;
ZBX_VECTOR_IMPL(strloc, zbx_strloc_t)
/******************************************************************************
* *
* Purpose: rename macros in the string *
* *
* Parameters: in - [IN] the input string *
* oldmacro - [IN] the macro to rename *
* newmacro - [IN] the new macro name *
* out - [IN/OUT] the string with renamed macros *
* out_alloc - [IN/OUT] the output buffer size *
* *
* Return value: SUCCEED - macros were found and renamed *
* FAIL - no target macros were found *
* *
* Comments: If the oldmacro is found in input string then all occurrences of *
* it are replaced with the new macro in the output string. *
* Otherwise the output string is not changed. *
* *