From: Ben Pfaff Date: Thu, 6 Aug 2009 04:27:25 +0000 (-0700) Subject: Eliminate casts that can be replaced by uses of the & operator. X-Git-Tag: sid-i386-build98~13 X-Git-Url: https://pintos-os.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=b46b794dfb9f0758aafec83f50993d1930894099;p=pspp-builds.git Eliminate casts that can be replaced by uses of the & operator. This increases type safety and so it's hard to see any downside. --- diff --git a/src/language/stats/aggregate.c b/src/language/stats/aggregate.c index 0d181bd4..3af2cd8d 100644 --- a/src/language/stats/aggregate.c +++ b/src/language/stats/aggregate.c @@ -965,20 +965,20 @@ dump_aggregate_info (struct agr_proc *agr, struct casewriter *output) case MEDIAN: { struct casereader *sorted_reader; - struct order_stats *median = percentile_create (0.5, i->cc); + struct percentile *median = percentile_create (0.5, i->cc); + struct order_stats *os = &median->parent; sorted_reader = casewriter_make_reader (i->writer); - order_stats_accumulate (&median, 1, + order_stats_accumulate (&os, 1, sorted_reader, i->weight, i->subject, i->exclude); - v->f = percentile_calculate ((struct percentile *) median, - PC_HAVERAGE); + v->f = percentile_calculate (median, PC_HAVERAGE); - statistic_destroy ((struct statistic *) median); + statistic_destroy (&median->parent.parent); } break; case SD: diff --git a/src/language/stats/chisquare.c b/src/language/stats/chisquare.c index 8e27e0dd..5c20896a 100644 --- a/src/language/stats/chisquare.c +++ b/src/language/stats/chisquare.c @@ -305,8 +305,8 @@ chisquare_execute (const struct dataset *ds, { const struct dictionary *dict = dataset_dict (ds); int v, i; - struct one_sample_test *ost = (struct one_sample_test *) test; struct chisquare_test *cst = (struct chisquare_test *) test; + struct one_sample_test *ost = &cst->parent; int n_cells = 0; double total_expected = 0.0; const struct variable *wvar = dict_get_weight (dict); diff --git a/src/language/stats/examine.q b/src/language/stats/examine.q index d17aebf9..acbdf3e0 100644 --- a/src/language/stats/examine.q +++ b/src/language/stats/examine.q @@ -104,11 +104,11 @@ struct factor_metrics struct percentile **ptl; size_t n_ptiles; - struct statistic *tukey_hinges; - struct statistic *box_whisker; - struct statistic *trimmed_mean; - struct statistic *histogram; - struct order_stats *np; + struct tukey_hinges *tukey_hinges; + struct box_whisker *box_whisker; + struct trimmed_mean *trimmed_mean; + struct histogram *histogram; + struct np *np; /* Three quartiles indexing into PTL */ struct percentile **quartiles; @@ -179,12 +179,12 @@ factor_destroy (struct xfactor *fctr) moments1_destroy (result->metrics[v].moments); extrema_destroy (result->metrics[v].minima); extrema_destroy (result->metrics[v].maxima); - statistic_destroy (result->metrics[v].trimmed_mean); - statistic_destroy (result->metrics[v].tukey_hinges); - statistic_destroy (result->metrics[v].box_whisker); - statistic_destroy (result->metrics[v].histogram); + statistic_destroy (&result->metrics[v].trimmed_mean->parent.parent); + statistic_destroy (&result->metrics[v].tukey_hinges->parent.parent); + statistic_destroy (&result->metrics[v].box_whisker->parent.parent); + statistic_destroy (&result->metrics[v].histogram->parent); for (i = 0 ; i < result->metrics[v].n_ptiles; ++i) - statistic_destroy ((struct statistic *) result->metrics[v].ptl[i]); + statistic_destroy (&result->metrics[v].ptl[i]->parent.parent); free (result->metrics[v].ptl); free (result->metrics[v].quartiles); casereader_destroy (result->metrics[v].up_reader); @@ -347,7 +347,7 @@ show_npplot (const struct variable **dependent_var, ds_put_format (&label, "%s ", var_get_name (dependent_var[v])); factor_to_string (fctr, result, &label); - np = (struct np *) result->metrics[v].np; + np = result->metrics[v].np; reader = casewriter_make_reader (np->writer); npp = np_plot_create (np, reader, ds_cstr (&label)); dnpp = dnp_plot_create (np, reader, ds_cstr (&label)); @@ -392,7 +392,7 @@ show_histogram (const struct variable **dependent_var, struct histogram *histogram; double mean, var, n; - histogram = (struct histogram *) result->metrics[v].histogram; + histogram = result->metrics[v].histogram; if (histogram == NULL) { /* Probably all values are SYSMIS. */ @@ -404,7 +404,7 @@ show_histogram (const struct variable **dependent_var, factor_to_string (fctr, result, &str); - moments1_calculate ((struct moments1 *) result->metrics[v].moments, + moments1_calculate (result->metrics[v].moments, &n, &mean, &var, NULL, NULL); chart_submit (histogram_chart_create (histogram, ds_cstr (&str), n, mean, sqrt (var), false)); @@ -466,9 +466,7 @@ show_boxplot_groups (const struct variable **dependent_var, struct factor_metrics *metrics = &result->metrics[v]; struct string str = DS_EMPTY_INITIALIZER; factor_to_string_concise (fctr, result, &str); - boxplot_add_box (boxplot, - (struct box_whisker *) metrics->box_whisker, - ds_cstr (&str)); + boxplot_add_box (boxplot, metrics->box_whisker, ds_cstr (&str)); metrics->box_whisker = NULL; ds_destroy (&str); } @@ -516,8 +514,7 @@ show_boxplot_variables (const struct variable **dependent_var, for (v = 0; v < n_dep_var; ++v) { struct factor_metrics *metrics = &result->metrics[v]; - boxplot_add_box (boxplot, - (struct box_whisker *) metrics->box_whisker, + boxplot_add_box (boxplot, metrics->box_whisker, var_get_name (dependent_var[v])); metrics->box_whisker = NULL; } @@ -884,15 +881,13 @@ examine_group (struct cmd_examine *cmd, struct casereader *reader, int level, metric->n_ptiles = percentile_list.n_data; - metric->ptl = xcalloc (metric->n_ptiles, - sizeof (struct percentile *)); + metric->ptl = xcalloc (metric->n_ptiles, sizeof *metric->ptl); metric->quartiles = xcalloc (3, sizeof (*metric->quartiles)); for (i = 0 ; i < metric->n_ptiles; ++i) { - metric->ptl[i] = (struct percentile *) - percentile_create (percentile_list.data[i] / 100.0, metric->n_valid); + metric->ptl[i] = percentile_create (percentile_list.data[i] / 100.0, metric->n_valid); if ( percentile_list.data[i] == 25) metric->quartiles[0] = metric->ptl[i]; @@ -913,18 +908,18 @@ examine_group (struct cmd_examine *cmd, struct casereader *reader, int level, n_os ++; } - os = xcalloc (sizeof (struct order_stats *), n_os); + os = xcalloc (n_os, sizeof *os); for (i = 0 ; i < metric->n_ptiles ; ++i ) { - os[i] = (struct order_stats *) metric->ptl[i]; + os[i] = &metric->ptl[i]->parent; } - os[i] = (struct order_stats *) metric->tukey_hinges; - os[i+1] = (struct order_stats *) metric->trimmed_mean; + os[i] = &metric->tukey_hinges->parent; + os[i+1] = &metric->trimmed_mean->parent; if (cmd->a_plot[XMN_PLT_NPPLOT]) - os[i+2] = metric->np; + os[i+2] = &metric->np->parent; order_stats_accumulate (os, n_os, casereader_clone (metric->up_reader), @@ -975,7 +970,7 @@ examine_group (struct cmd_examine *cmd, struct casereader *reader, int level, { struct factor_metrics *metric = &result->metrics[v]; if ( metric->histogram) - histogram_add ((struct histogram *) metric->histogram, + histogram_add (metric->histogram, case_data (c, dependent_vars[v])->f, weight); } case_unref (c); @@ -991,13 +986,12 @@ examine_group (struct cmd_examine *cmd, struct casereader *reader, int level, struct factor_metrics *metric = &result->metrics[v]; int n_vals = caseproto_get_n_widths (casereader_get_proto ( metric->up_reader)); + struct order_stats *os = &metric->box_whisker->parent; metric->box_whisker = - box_whisker_create ((struct tukey_hinges *) metric->tukey_hinges, - cmd->v_id, n_vals - 1); + box_whisker_create ( metric->tukey_hinges, cmd->v_id, n_vals - 1); - order_stats_accumulate ((struct order_stats **) &metric->box_whisker, - 1, + order_stats_accumulate ( &os, 1, casereader_clone (metric->up_reader), wv, dependent_vars[v], MV_ANY); } @@ -1554,7 +1548,7 @@ show_descriptives (const struct variable **dependent_var, tab_double (tbl, n_cols - 2, heading_rows + row_var_start + 3 + i * DESCRIPTIVE_ROWS, TAB_CENTER, - trimmed_mean_calculate ((struct trimmed_mean *) result->metrics[v].trimmed_mean), + trimmed_mean_calculate (result->metrics[v].trimmed_mean), NULL); @@ -1975,8 +1969,7 @@ show_percentiles (const struct variable **dependent_var, tab_vline (tbl, TAL_1, n_cols - n_percentiles -1, heading_rows, n_rows - 1); - tukey_hinges_calculate ((struct tukey_hinges *) result->metrics[v].tukey_hinges, - hinges); + tukey_hinges_calculate (result->metrics[v].tukey_hinges, hinges); for (j = 0; j < n_percentiles; ++j) { diff --git a/src/language/stats/frequencies.q b/src/language/stats/frequencies.q index 9fcd9a18..2ffeafe5 100644 --- a/src/language/stats/frequencies.q +++ b/src/language/stats/frequencies.q @@ -617,7 +617,7 @@ postcalc (const struct dataset *ds) d[frq_stddev], normal)); - statistic_destroy ((struct statistic *)hist); + statistic_destroy (&hist->parent); } if ( chart == GFT_PIE) @@ -1459,7 +1459,7 @@ freq_tab_to_hist (const struct freq_tab *ft, const struct variable *var) double x_min = DBL_MAX; double x_max = -DBL_MAX; - struct statistic *hist; + struct histogram *hist; const double bins = 11; struct hsh_iterator hi; @@ -1481,10 +1481,10 @@ freq_tab_to_hist (const struct freq_tab *ft, const struct variable *var) for( i = 0 ; i < ft->n_valid ; ++i ) { frq = &ft->valid[i]; - histogram_add ((struct histogram *)hist, frq->value.f, frq->count); + histogram_add (hist, frq->value.f, frq->count); } - return (struct histogram *)hist; + return hist; } diff --git a/src/language/stats/npar.q b/src/language/stats/npar.q index bbccce67..c8c44e6d 100644 --- a/src/language/stats/npar.q +++ b/src/language/stats/npar.q @@ -223,10 +223,11 @@ npar_custom_chisquare (struct lexer *lexer, struct dataset *ds, struct npar_specs *specs = aux; struct chisquare_test *cstp = pool_alloc(specs->pool, sizeof(*cstp)); - struct one_sample_test *tp = (struct one_sample_test *) cstp; + struct one_sample_test *tp = &cstp->parent; + struct npar_test *nt = &tp->parent; - ((struct npar_test *)tp)->execute = chisquare_execute; - ((struct npar_test *)tp)->insert_variables = one_sample_insert_variables; + nt->execute = chisquare_execute; + nt->insert_variables = one_sample_insert_variables; if (!parse_variables_const_pool (lexer, specs->pool, dataset_dict (ds), &tp->vars, &tp->n_vars, @@ -316,7 +317,7 @@ npar_custom_chisquare (struct lexer *lexer, struct dataset *ds, specs->test, sizeof(*specs->test) * specs->n_tests); - specs->test[specs->n_tests - 1] = (struct npar_test *) tp; + specs->test[specs->n_tests - 1] = nt; return 1; } @@ -328,10 +329,11 @@ npar_custom_binomial (struct lexer *lexer, struct dataset *ds, { struct npar_specs *specs = aux; struct binomial_test *btp = pool_alloc(specs->pool, sizeof(*btp)); - struct one_sample_test *tp = (struct one_sample_test *) btp; + struct one_sample_test *tp = &btp->parent; + struct npar_test *nt = &tp->parent; - ((struct npar_test *)tp)->execute = binomial_execute; - ((struct npar_test *)tp)->insert_variables = one_sample_insert_variables; + nt->execute = binomial_execute; + nt->insert_variables = one_sample_insert_variables; btp->category1 = btp->category2 = btp->cutpoint = SYSMIS; @@ -381,7 +383,7 @@ npar_custom_binomial (struct lexer *lexer, struct dataset *ds, specs->test, sizeof(*specs->test) * specs->n_tests); - specs->test[specs->n_tests - 1] = (struct npar_test *) tp; + specs->test[specs->n_tests - 1] = nt; return 1; } @@ -412,7 +414,7 @@ parse_two_sample_related_test (struct lexer *lexer, const struct variable **vlist2; size_t n_vlist2; - ((struct npar_test *)test_parameters)->insert_variables = two_sample_insert_variables; + test_parameters->parent.insert_variables = two_sample_insert_variables; if (!parse_variables_const_pool (lexer, pool, dict, @@ -512,7 +514,8 @@ npar_custom_wilcoxon (struct lexer *lexer, struct npar_specs *specs = aux; struct two_sample_test *tp = pool_alloc (specs->pool, sizeof(*tp)); - ((struct npar_test *)tp)->execute = wilcoxon_execute; + struct npar_test *nt = &tp->parent; + nt->execute = wilcoxon_execute; if (!parse_two_sample_related_test (lexer, dataset_dict (ds), cmd, tp, specs->pool) ) @@ -522,7 +525,7 @@ npar_custom_wilcoxon (struct lexer *lexer, specs->test = pool_realloc (specs->pool, specs->test, sizeof(*specs->test) * specs->n_tests); - specs->test[specs->n_tests - 1] = (struct npar_test *) tp; + specs->test[specs->n_tests - 1] = nt; return 1; } @@ -535,7 +538,8 @@ npar_custom_mcnemar (struct lexer *lexer, struct npar_specs *specs = aux; struct two_sample_test *tp = pool_alloc(specs->pool, sizeof(*tp)); - ((struct npar_test *)tp)->execute = NULL; + struct npar_test *nt = &tp->parent; + nt->execute = NULL; if (!parse_two_sample_related_test (lexer, dataset_dict (ds), @@ -546,7 +550,7 @@ npar_custom_mcnemar (struct lexer *lexer, specs->test = pool_realloc (specs->pool, specs->test, sizeof(*specs->test) * specs->n_tests); - specs->test[specs->n_tests - 1] = (struct npar_test *) tp; + specs->test[specs->n_tests - 1] = nt; return 1; } @@ -558,7 +562,9 @@ npar_custom_sign (struct lexer *lexer, struct dataset *ds, struct npar_specs *specs = aux; struct two_sample_test *tp = pool_alloc(specs->pool, sizeof(*tp)); - ((struct npar_test *) tp)->execute = sign_execute; + struct npar_test *nt = &tp->parent; + + nt->execute = sign_execute; if (!parse_two_sample_related_test (lexer, dataset_dict (ds), cmd, tp, specs->pool) ) @@ -568,7 +574,7 @@ npar_custom_sign (struct lexer *lexer, struct dataset *ds, specs->test = pool_realloc (specs->pool, specs->test, sizeof(*specs->test) * specs->n_tests); - specs->test[specs->n_tests - 1] = (struct npar_test *) tp; + specs->test[specs->n_tests - 1] = nt; return 1; } diff --git a/src/math/box-whisker.c b/src/math/box-whisker.c index 288fc072..3712235e 100644 --- a/src/math/box-whisker.c +++ b/src/math/box-whisker.c @@ -1,5 +1,5 @@ /* PSPP - a program for statistical analysis. - Copyright (C) 2008 Free Software Foundation, Inc. + Copyright (C) 2008, 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 @@ -110,7 +110,7 @@ box_whisker_outliers (const struct box_whisker *bw) return &bw->outliers; } -struct statistic * +struct box_whisker * box_whisker_create (const struct tukey_hinges *th, const struct variable *id_var, size_t casenumber_idx) { @@ -135,5 +135,5 @@ box_whisker_create (const struct tukey_hinges *th, ll_init (&w->outliers); - return stat; + return w; } diff --git a/src/math/box-whisker.h b/src/math/box-whisker.h index 5202b646..bef091e8 100644 --- a/src/math/box-whisker.h +++ b/src/math/box-whisker.h @@ -1,5 +1,5 @@ /* PSPP - a program for statistical analysis. - Copyright (C) 2008 Free Software Foundation, Inc. + Copyright (C) 2008, 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 @@ -52,7 +52,7 @@ struct box_whisker const struct variable *id_var; }; -struct statistic * box_whisker_create (const struct tukey_hinges *, +struct box_whisker * box_whisker_create (const struct tukey_hinges *, const struct variable *, size_t); void box_whisker_whiskers (const struct box_whisker *bw, double whiskers[2]); diff --git a/src/math/histogram.c b/src/math/histogram.c index 67079398..c41bdc08 100644 --- a/src/math/histogram.c +++ b/src/math/histogram.c @@ -1,5 +1,5 @@ /* PSPP - a program for statistical analysis. - Copyright (C) 2004, 2008 Free Software Foundation, Inc. + Copyright (C) 2004, 2008, 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 @@ -28,7 +28,8 @@ void histogram_add (struct histogram *h, double y, double c) { - ((struct statistic *)h)->accumulate ((struct statistic *) h, NULL, c, 0, y); + struct statistic *stat = &h->parent; + stat->accumulate (stat, NULL, c, 0, y); } @@ -51,11 +52,11 @@ destroy (struct statistic *s) } -struct statistic * +struct histogram * histogram_create (int bins, double min, double max) { struct histogram *h = xmalloc (sizeof *h); - struct statistic *stat = (struct statistic *) h; + struct statistic *stat = &h->parent; double upper_limit, lower_limit; double bin_width = chart_rounded_tick ((max - min) / (double) bins); @@ -78,6 +79,6 @@ histogram_create (int bins, double min, double max) stat->accumulate = acc; stat->destroy = destroy; - return stat; + return h; } diff --git a/src/math/histogram.h b/src/math/histogram.h index b2b204ee..bc4a5ae6 100644 --- a/src/math/histogram.h +++ b/src/math/histogram.h @@ -1,5 +1,5 @@ /* PSPP - a program for statistical analysis. - Copyright (C) 2008 Free Software Foundation, Inc. + Copyright (C) 2008, 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 @@ -30,7 +30,7 @@ struct histogram gsl_histogram *gsl_hist; }; -struct statistic * histogram_create (int bins, double max, double min); +struct histogram * histogram_create (int bins, double max, double min); void histogram_add (struct histogram *h, double y, double c); diff --git a/src/math/np.c b/src/math/np.c index e61bf58e..d36acc2a 100644 --- a/src/math/np.c +++ b/src/math/np.c @@ -69,13 +69,13 @@ acc (struct statistic *s, const struct ccase *cx UNUSED, np->prev_cc = cc; } -struct order_stats * +struct np * np_create (const struct moments1 *m) { double variance; struct np *np = xzalloc (sizeof (*np)); - struct statistic *stat = (struct statistic *) np; - struct order_stats *os = (struct order_stats *) np; + struct order_stats *os = &np->parent; + struct statistic *stat = &os->parent; struct caseproto *proto; int i; @@ -98,5 +98,5 @@ np_create (const struct moments1 *m) stat->destroy = destroy; stat->accumulate = acc; - return os; + return np; } diff --git a/src/math/np.h b/src/math/np.h index 7db51f73..b5265bd4 100644 --- a/src/math/np.h +++ b/src/math/np.h @@ -1,5 +1,5 @@ /* PSPP - a program for statistical analysis. - Copyright (C) 2008 Free Software Foundation, Inc. + Copyright (C) 2008, 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 @@ -54,6 +54,6 @@ struct np }; -struct order_stats * np_create (const struct moments1 *); +struct np * np_create (const struct moments1 *); #endif diff --git a/src/math/order-stats.c b/src/math/order-stats.c index 1b6aa131..e550d2b2 100644 --- a/src/math/order-stats.c +++ b/src/math/order-stats.c @@ -90,7 +90,7 @@ update_k_values (const struct ccase *cx, double y_i, double c_i, double cc_i, { int k; struct order_stats *tos = os[j]; - struct statistic *stat = (struct statistic *) tos; + struct statistic *stat = &tos->parent; for (k = 0 ; k < tos->n_k; ++k) { struct k *myk = &tos->k[k]; diff --git a/src/math/percentiles.c b/src/math/percentiles.c index bf99de16..3aec0c96 100644 --- a/src/math/percentiles.c +++ b/src/math/percentiles.c @@ -1,5 +1,5 @@ /* PSPP - a program for statistical analysis. - Copyright (C) 2008 Free Software Foundation, Inc. + Copyright (C) 2008, 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 @@ -160,12 +160,12 @@ destroy (struct statistic *stat) } -struct order_stats * +struct percentile * percentile_create (double p, double W) { struct percentile *ptl = xzalloc (sizeof (*ptl)); - struct order_stats *os = (struct order_stats *) ptl; - struct statistic *stat = (struct statistic *) ptl; + struct order_stats *os = &ptl->parent; + struct statistic *stat = &os->parent; assert (p >= 0); assert (p <= 1.0); @@ -186,6 +186,6 @@ percentile_create (double p, double W) stat->destroy = destroy; - return os; + return ptl; } diff --git a/src/math/percentiles.h b/src/math/percentiles.h index 0dd09820..ff46bea6 100644 --- a/src/math/percentiles.h +++ b/src/math/percentiles.h @@ -1,5 +1,5 @@ /* PSPP - a program for statistical analysis. - Copyright (C) 2004, 2008 Free Software Foundation, Inc. + Copyright (C) 2004, 2008, 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 @@ -52,7 +52,7 @@ struct percentile /* Create the Pth percentile. W is the total sum of weights in the data set */ -struct order_stats *percentile_create (double p, double W); +struct percentile *percentile_create (double p, double W); /* Return the value of the percentile */ double percentile_calculate (const struct percentile *ptl, enum pc_alg alg); diff --git a/src/math/trimmed-mean.c b/src/math/trimmed-mean.c index da3d4240..6e43f7b0 100644 --- a/src/math/trimmed-mean.c +++ b/src/math/trimmed-mean.c @@ -1,5 +1,5 @@ /* PSPP - a program for statistical analysis. - Copyright (C) 2008 Free Software Foundation, Inc. + Copyright (C) 2008, 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 @@ -28,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 order_stats *os = (struct order_stats *) s; + struct order_stats *os = &tm->parent; if ( cc > os->k[0].tc && cc < os->k[1].tc) tm->sum += c * y; @@ -45,12 +45,12 @@ destroy (struct statistic *s) free (s); } -struct statistic * +struct trimmed_mean * trimmed_mean_create (double W, double tail) { struct trimmed_mean *tm = xzalloc (sizeof (*tm)); - struct order_stats *os = (struct order_stats *) tm; - struct statistic *stat = (struct statistic *) tm; + struct order_stats *os = &tm->parent; + struct statistic *stat = &os->parent; os->n_k = 2; os->k = xcalloc (sizeof (*os->k), 2); @@ -68,7 +68,7 @@ trimmed_mean_create (double W, double tail) tm->w = W; tm->tail = tail; - return stat; + return tm; } diff --git a/src/math/trimmed-mean.h b/src/math/trimmed-mean.h index 9339cab9..c667b1be 100644 --- a/src/math/trimmed-mean.h +++ b/src/math/trimmed-mean.h @@ -1,5 +1,5 @@ /* PSPP - a program for statistical analysis. - Copyright (C) 2008 Free Software Foundation, Inc. + Copyright (C) 2008, 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 @@ -36,7 +36,7 @@ struct trimmed_mean double tail; }; -struct statistic * trimmed_mean_create (double W, double c_min); +struct trimmed_mean * trimmed_mean_create (double W, double c_min); double trimmed_mean_calculate (const struct trimmed_mean *); #endif diff --git a/src/math/tukey-hinges.c b/src/math/tukey-hinges.c index 95a79c1d..ded7a9c6 100644 --- a/src/math/tukey-hinges.c +++ b/src/math/tukey-hinges.c @@ -1,5 +1,5 @@ /* PSPP - a program for statistical analysis. - Copyright (C) 2008 Free Software Foundation, Inc. + Copyright (C) 2008, 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 @@ -65,13 +65,13 @@ destroy (struct statistic *s) free (s); }; -struct statistic * +struct tukey_hinges * tukey_hinges_create (double W, double c_min) { double d; struct tukey_hinges *th = xzalloc (sizeof (*th)); - struct order_stats *os = (struct order_stats *) th; - struct statistic *stat = (struct statistic *) th; + struct order_stats *os = &th->parent; + struct statistic *stat = &os->parent; assert (c_min >= 0); @@ -97,5 +97,5 @@ tukey_hinges_create (double W, double c_min) stat->destroy = destroy; - return stat; + return th; } diff --git a/src/math/tukey-hinges.h b/src/math/tukey-hinges.h index d87691f8..4b509da1 100644 --- a/src/math/tukey-hinges.h +++ b/src/math/tukey-hinges.h @@ -1,5 +1,5 @@ /* PSPP - a program for statistical analysis. - Copyright (C) 2008 Free Software Foundation, Inc. + Copyright (C) 2008, 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 @@ -27,7 +27,7 @@ struct tukey_hinges struct order_stats parent; }; -struct statistic * tukey_hinges_create (double W, double c_min); +struct tukey_hinges * tukey_hinges_create (double W, double c_min); void tukey_hinges_calculate (const struct tukey_hinges *h, double hinge[3]); diff --git a/src/ui/gui/find-dialog.c b/src/ui/gui/find-dialog.c index 86d29583..a02ed6e2 100644 --- a/src/ui/gui/find-dialog.c +++ b/src/ui/gui/find-dialog.c @@ -583,7 +583,7 @@ value_comparator_create (const struct variable *var, const char *target) const struct fmt_spec *fmt; int width ; struct value_comparator *vc = xzalloc (sizeof (*vc)); - struct comparator *cmptr = (struct comparator *) vc; + struct comparator *cmptr = &vc->parent; cmptr->flags = 0; cmptr->var = var; @@ -614,7 +614,7 @@ string_comparator_create (const struct variable *var, const char *target, enum string_cmp_flags flags) { struct string_comparator *ssc = xzalloc (sizeof (*ssc)); - struct comparator *cmptr = (struct comparator *) ssc; + struct comparator *cmptr = &ssc->parent; cmptr->flags = flags; cmptr->var = var; @@ -636,7 +636,7 @@ regexp_comparator_create (const struct variable *var, const char *target, { int code; struct regexp_comparator *rec = xzalloc (sizeof (*rec)); - struct comparator *cmptr = (struct comparator *) rec; + struct comparator *cmptr = &rec->parent; cmptr->flags = flags; cmptr->var = var; diff --git a/src/ui/gui/syntax-editor-source.c b/src/ui/gui/syntax-editor-source.c index 21437051..b4a8918f 100644 --- a/src/ui/gui/syntax-editor-source.c +++ b/src/ui/gui/syntax-editor-source.c @@ -1,5 +1,5 @@ /* PSPPIRE - a graphical user interface for PSPP. - Copyright (C) 2006 Free Software Foundation + Copyright (C) 2006, 2009 Free Software Foundation 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 @@ -124,5 +124,5 @@ create_syntax_editor_source (GtkTextBuffer *buffer, ses->parent.location = location; - return (struct getl_interface *) ses; + return &ses->parent; } diff --git a/src/ui/terminal/read-line.c b/src/ui/terminal/read-line.c index 7b23f38d..5c9baa5b 100644 --- a/src/ui/terminal/read-line.c +++ b/src/ui/terminal/read-line.c @@ -1,5 +1,5 @@ /* PSPP - a program for statistical analysis. - Copyright (C) 1997-9, 2000, 2007 Free Software Foundation, Inc. + Copyright (C) 1997-9, 2000, 2007, 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 @@ -215,7 +215,7 @@ create_readln_source (void) rlns->parent.read = read_interactive; rlns->parent.close = readln_close; - return (struct getl_interface *) rlns; + return &rlns->parent; }