From: Ben Pfaff <blp@gnu.org>
Date: Fri, 29 Apr 2005 01:58:28 +0000 (+0000)
Subject: Improve previous fix for PR 12858 (LAG).
X-Git-Tag: v0.4.0~107
X-Git-Url: https://pintos-os.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=0e3829dd353c7a7300160d46e81c7435120e16cd;p=pspp-builds.git

Improve previous fix for PR 12858 (LAG).
---

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  <blp@gnu.org>
+
+	* expressions/parse.c: Improve previous fix for PR 12858 (LAG).
+
 Fri Apr 29 09:28:00 WST 2005 John Darrington <john@darrington.wattle.id.au>
 
 	* 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;
     }