X-Git-Url: https://arthur.barton.de/gitweb/?a=blobdiff_plain;f=src%2Feval.c;h=122959ce4edb06d6ea99999838e53ec320d1046a;hb=65cd61cc91763c1d95c2c2d2701c1f7be49a3a4c;hp=94c978e3eaaa59639d928907fef6e9b07f622ee1;hpb=ce020f0840110bdd5bc8ffab523a3a3771fa0afb;p=netdata.git diff --git a/src/eval.c b/src/eval.c index 94c978e3..122959ce 100644 --- a/src/eval.c +++ b/src/eval.c @@ -102,7 +102,7 @@ static inline calculated_number eval_variable(EVAL_EXPRESSION *exp, EVAL_VARIABL } if(unlikely(v->hash == now_hash && !strcmp(v->name, "now"))) { - n = time(NULL); + n = now_realtime_sec(); buffer_strcat(exp->error_msg, "[ $now = "); print_parsed_as_constant(exp->error_msg, n); buffer_strcat(exp->error_msg, " ] "); @@ -1031,9 +1031,7 @@ static inline EVAL_NODE *parse_rest_of_expression(const char **string, int *erro // high level function to parse an expression or a sub-expression static inline EVAL_NODE *parse_full_expression(const char **string, int *error) { - EVAL_NODE *op1 = NULL; - - op1 = parse_one_full_operand(string, error); + EVAL_NODE *op1 = parse_one_full_operand(string, error); if(!op1) { *error = EVAL_ERROR_MISSING_OPERAND; return NULL; @@ -1081,7 +1079,6 @@ int expression_evaluate(EVAL_EXPRESSION *exp) { EVAL_EXPRESSION *expression_parse(const char *string, const char **failed_at, int *error) { const char *s = string; int err = EVAL_ERROR_OK; - unsigned long pos = 0; EVAL_NODE *op = parse_full_expression(&s, &err); @@ -1097,7 +1094,7 @@ EVAL_EXPRESSION *expression_parse(const char *string, const char **failed_at, in if (error) *error = err; if(!op) { - pos = s - string + 1; + unsigned long pos = s - string + 1; error("failed to parse expression '%s': %s at character %lu (i.e.: '%s').", string, expression_strerror(err), pos, s); return NULL; }