From: Jason Stover Date: Sat, 8 Mar 2008 18:58:58 +0000 (+0000) Subject: Fix bug 22419 X-Git-Tag: v0.6.0~67 X-Git-Url: https://pintos-os.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=b9f6480f1b451cb7873bb0591369504ff1b92595;p=pspp-builds.git Fix bug 22419 --- diff --git a/src/math/linreg/ChangeLog b/src/math/linreg/ChangeLog index 1bf0ed98..552d093b 100644 --- a/src/math/linreg/ChangeLog +++ b/src/math/linreg/ChangeLog @@ -1,3 +1,8 @@ +2008-03-08 Jason Stover + + * linreg.c (pspp_linreg_get_vars): Clean up the loop that searches + for coefficient/variable matches. Fix for bug 22419. + 2008-02-28 Jason Stover * linreg.c (has_coefficient): New function. diff --git a/src/math/linreg/linreg.c b/src/math/linreg/linreg.c index 6bd450a1..9465875e 100644 --- a/src/math/linreg/linreg.c +++ b/src/math/linreg/linreg.c @@ -94,9 +94,9 @@ int pspp_linreg_get_vars (const void *c_, const struct variable **v) { const pspp_linreg_cache *c = c_; - struct pspp_coeff *coef = NULL; const struct variable *tmp; int i; + int j; int result = 0; /* @@ -110,12 +110,9 @@ pspp_linreg_get_vars (const void *c_, const struct variable **v) /* Start at c->coeff[1] to avoid the intercept. */ - v[result] = pspp_coeff_get_var (c->coeff[1], 0); - result = (v[result] == NULL) ? 0 : 1; - - for (coef = c->coeff[2]; coef < c->coeff[c->n_coeffs]; coef++) + for (j = 1; j < c->n_coeffs; j++) { - tmp = pspp_coeff_get_var (coef, 0); + tmp = pspp_coeff_get_var (c->coeff[j], 0); assert (tmp != NULL); /* Repeated variables are likely to bunch together, at the end of the array. */