X-Git-Url: https://pintos-os.org/cgi-bin/gitweb.cgi?a=blobdiff_plain;f=src%2Fmath%2Ftrimmed-mean.c;h=d1cc6b708279098ab8d263b95923d9b31c968ed6;hb=173d1687aea88e0e5e1b1d8615ed68ebefb15d08;hp=6e43f7b0aecc7fd98623bb816c809051259cf79d;hpb=b46b794dfb9f0758aafec83f50993d1930894099;p=pspp diff --git a/src/math/trimmed-mean.c b/src/math/trimmed-mean.c index 6e43f7b0ae..d1cc6b7082 100644 --- a/src/math/trimmed-mean.c +++ b/src/math/trimmed-mean.c @@ -20,6 +20,7 @@ #include #include +#include #include #include @@ -27,7 +28,7 @@ static void acc (struct statistic *s, const struct ccase *cx UNUSED, double c, double cc, double y) { - struct trimmed_mean *tm = (struct trimmed_mean *) s; + struct trimmed_mean *tm = UP_CAST (s, struct trimmed_mean, parent.parent); struct order_stats *os = &tm->parent; if ( cc > os->k[0].tc && cc < os->k[1].tc) @@ -40,9 +41,10 @@ acc (struct statistic *s, const struct ccase *cx UNUSED, double c, double cc, do static void destroy (struct statistic *s) { - struct order_stats *os = (struct order_stats *) s; + struct trimmed_mean *tm = UP_CAST (s, struct trimmed_mean, parent.parent); + struct order_stats *os = &tm->parent; free (os->k); - free (s); + free (tm); } struct trimmed_mean *