diff options
Diffstat (limited to 'src/libs/zbxserver/expression.c')
-rw-r--r-- | src/libs/zbxserver/expression.c | 92 |
1 files changed, 0 insertions, 92 deletions
diff --git a/src/libs/zbxserver/expression.c b/src/libs/zbxserver/expression.c index 396f60f6f2c..e5d444bac49 100644 --- a/src/libs/zbxserver/expression.c +++ b/src/libs/zbxserver/expression.c @@ -81,98 +81,6 @@ static int substitute_key_macros_impl(char **data, zbx_uint64_t *hostid, DC_ITEM const struct zbx_json_parse *jp_row, const zbx_vector_ptr_t *lld_macro_paths, int macro_type, char *error, size_t maxerrlen); -/****************************************************************************** - * * - * Function: get_N_functionid * - * * - * Parameters: expression - [IN] null terminated trigger expression * - * '{11}=1 & {2346734}>5' * - * N_functionid - [IN] number of function in trigger expression * - * functionid - [OUT] ID of an N-th function in expression * - * end - [OUT] a pointer to text following the extracted * - * function id (can be NULL) * - * * - ******************************************************************************/ -int get_N_functionid(const char *expression, int N_functionid, zbx_uint64_t *functionid, const char **end) -{ - enum state_t {NORMAL, ID} state = NORMAL; - int num = 0, ret = FAIL; - const char *c, *p_functionid = NULL; - - for (c = expression; '\0' != *c; c++) - { - if ('{' == *c) - { - /* skip user macros */ - if ('$' == c[1]) - { - int macro_r, context_l, context_r; - - if (SUCCEED == zbx_user_macro_parse(c, ¯o_r, &context_l, &context_r, NULL)) - c += macro_r; - else - c++; - - continue; - } - - state = ID; - p_functionid = c + 1; - } - else if ('}' == *c && ID == state && NULL != p_functionid) - { - if (SUCCEED == is_uint64_n(p_functionid, c - p_functionid, functionid)) - { - if (++num == N_functionid) - { - if (NULL != end) - *end = c + 1; - - ret = SUCCEED; - break; - } - } - - state = NORMAL; - } - } - - return ret; -} - -/****************************************************************************** - * * - * Function: get_trigger_expression_constant * - * * - * Purpose: get constant from a trigger expression corresponding a given * - * reference from trigger name * - * * - * Parameters: expression - [IN] trigger expression, source of constants * - * reference - [IN] reference from a trigger name ($1, $2, ...) * - * constant - [OUT] the extracted constant or empty string, * - * must be freed by caller * - * * - ******************************************************************************/ -void get_trigger_expression_constant(const char *expression, const zbx_token_reference_t *reference, - char **constant) -{ - size_t pos; - zbx_strloc_t loc; - int index; - - for (pos = 0, index = 1; SUCCEED == zbx_expression_next_constant(expression, pos, &loc); - pos = loc.r + 1, index++) - { - if (index < reference->index) - continue; - - *constant = zbx_expression_extract_constant(expression, &loc); - return; - } - - *constant = zbx_strdup(*constant, ""); -} - static void DCexpand_trigger_expression(char **expression) { char *tmp = NULL; |