Source
xxxxxxxxxx
return ' ' == c || '(' == c || '\r' == c || '\n' == c || '\t' == c || ')' == c || '\0' == c ? SUCCEED : FAIL;
/*
** 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/>.
**/
/******************************************************************************
* *
* Module for evaluating expressions *
* --------------------------------------- *
* *
* Global variables are used for efficiency reasons so that arguments do not *
* have to be passed to each of evaluate_termX() functions. For this reason, *
* too, this module is isolated into a separate file. *
* *
* The priority of supported operators is as follows: *
* *
* - (unary) evaluate_term8() *
* not evaluate_term7() *
* * / evaluate_term6() *
* + - evaluate_term5() *
* < <= >= > evaluate_term4() *
* = <> evaluate_term3() *
* and evaluate_term2() *
* or evaluate_term1() *
* *
* Function evaluate_term9() is used for parsing tokens on the lowest level: *
* those can be suffixed numbers like "12.345K" or parenthesized expressions. *
* *
******************************************************************************/
static const char *ptr; /* character being looked at */
static int level; /* expression nesting level */
static char *buffer; /* error message buffer */
static size_t max_buffer_len; /* error message buffer size */
/******************************************************************************
* *
* Purpose: check whether the character delimits a numeric token. *
* *
******************************************************************************/
static int is_number_delimiter(char c)
{
return 0 == isdigit(c) && '.' != c && 0 == isalpha(c) ? SUCCEED : FAIL;
}
/******************************************************************************