X-Git-Url: https://pintos-os.org/cgi-bin/gitweb.cgi?a=blobdiff_plain;f=src%2Fmath%2Flevene.c;h=f7e269991346cd0c6cb076eacec04bcbbd62590c;hb=49add7c2b9bc18169182b2aa5c557b2512712a03;hp=4a9f130734dcceb18988182ea02b777983b77cb4;hpb=43b1296aafe7582e7dbe6c2b6a8b478d7d9b0fcf;p=pspp-builds.git diff --git a/src/math/levene.c b/src/math/levene.c index 4a9f1307..f7e26999 100644 --- a/src/math/levene.c +++ b/src/math/levene.c @@ -1,5 +1,5 @@ /* PSPP - a program for statistical analysis. - Copyright (C) 2004 Free Software Foundation, Inc. + Copyright (C) 2004, 2009 Free Software Foundation, Inc. This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -25,13 +25,14 @@ #include #include #include -#include #include #include "group.h" #include #include +#include "xalloc.h" + /* This module calculates the Levene statistic for variables. @@ -117,7 +118,7 @@ levene(const struct dictionary *dict, enum mv_class exclude) { struct casereader *pass1, *pass2; - struct ccase c; + struct ccase *c; struct levene_info l; l.n_dep = n_dep; @@ -130,14 +131,14 @@ levene(const struct dictionary *dict, casereader_split (reader, &pass1, &pass2); levene_precalc (&l); - for (; casereader_read (pass1, &c); case_destroy (&c)) - levene_calc (dict, &c, &l); + for (; (c = casereader_read (pass1)) != NULL; case_unref (c)) + levene_calc (dict, c, &l); casereader_destroy (pass1); levene_postcalc (&l); levene2_precalc(&l); - for (; casereader_read (pass2, &c); case_destroy (&c)) - levene2_calc (dict, &c, &l); + for (; (c = casereader_read (pass2)) != NULL; case_unref (c)) + levene2_calc (dict, c, &l); casereader_destroy (pass2); levene2_postcalc (&l); @@ -245,9 +246,7 @@ levene2_precalc (struct levene_info *l) struct hsh_table *hash = group_proc_get (var)->group_hash; - for(g = (struct group_statistics *) hsh_first(hash,&hi); - g != 0 ; - g = (struct group_statistics *) hsh_next(hash,&hi) ) + for (g = hsh_first(hash,&hi); g != 0; g = hsh_next(hash, &hi)) { g->lz_mean = g->lz_total / g->n ; } @@ -307,9 +306,7 @@ levene2_postcalc (struct levene_info *l) struct group_proc *gp = group_proc_get (var); struct hsh_table *hash = gp->group_hash; - for(g = (struct group_statistics *) hsh_first(hash,&hi); - g != 0 ; - g = (struct group_statistics *) hsh_next(hash,&hi) ) + for (g = hsh_first(hash, &hi); g != 0; g = hsh_next(hash, &hi)) { lz_numerator += g->n * pow2(g->lz_mean - l->lz[v].grand_mean ); }