From 0e3829dd353c7a7300160d46e81c7435120e16cd Mon Sep 17 00:00:00 2001 From: Ben Pfaff Date: Fri, 29 Apr 2005 01:58:28 +0000 Subject: [PATCH] Improve previous fix for PR 12858 (LAG). --- src/ChangeLog | 4 ++++ src/expressions/parse.c | 9 ++++++--- 2 files changed, 10 insertions(+), 3 deletions(-) diff --git a/src/ChangeLog b/src/ChangeLog index 9259c9f9..00bb9431 100644 --- a/src/ChangeLog +++ b/src/ChangeLog @@ -1,3 +1,7 @@ +Thu Apr 28 18:52:06 2005 Ben Pfaff + + * expressions/parse.c: Improve previous fix for PR 12858 (LAG). + Fri Apr 29 09:28:00 WST 2005 John Darrington * expressions/parse.c: Added handler for OP_LAG_Vn and OP_LAG_Vs. diff --git a/src/expressions/parse.c b/src/expressions/parse.c index 0abfbb8a..7af90feb 100644 --- a/src/expressions/parse.c +++ b/src/expressions/parse.c @@ -1204,15 +1204,18 @@ parse_function (struct expression *e) n = expr_allocate_composite (e, f - operations, args, arg_cnt); n->composite.min_valid = min_valid != -1 ? min_valid : f->array_min_elems; - if (n->type == OP_LAG_Vn || n->type == OP_LAG_Vs) - n_lag = 1; + if (n->type == OP_LAG_Vn || n->type == OP_LAG_Vs) + { + if (n_lag < 1) + n_lag = 1; + } else if (n->type == OP_LAG_Vnn || n->type == OP_LAG_Vsn) { int n_before; assert (n->composite.arg_cnt == 2); assert (n->composite.args[1]->type == OP_pos_int); n_before = n->composite.args[1]->integer.i; - if (n_before > n_lag) + if (n_lag < n_before) n_lag = n_before; } -- 2.30.2