]> arthur.barton.de Git - netdata.git/blobdiff - src/eval.c
dns_query_time plugin: added
[netdata.git] / src / eval.c
index 94c978e3eaaa59639d928907fef6e9b07f622ee1..122959ce4edb06d6ea99999838e53ec320d1046a 100644 (file)
@@ -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;
     }