From bc5c6c1953ada1737620e27e6a968392a38d8c8f Mon Sep 17 00:00:00 2001 From: Ben Pfaff Date: Tue, 9 Aug 2022 22:39:18 -0700 Subject: [PATCH] Revert "work on crash" This reverts commit 7cd70df07f7e183645853716642810afd4b87bcd. --- src/language/stats/ctables.c | 30 +++++++++++------------------- tests/language/stats/ctables.at | 9 --------- 2 files changed, 11 insertions(+), 28 deletions(-) diff --git a/src/language/stats/ctables.c b/src/language/stats/ctables.c index 2833ce6b51..da511b6951 100644 --- a/src/language/stats/ctables.c +++ b/src/language/stats/ctables.c @@ -4362,8 +4362,6 @@ ctables_format (double d, const struct fmt_spec *format, static void ctables_table_output (struct ctables *ct, struct ctables_table *t) { - printf ("\n"); - struct pivot_table *pt = pivot_table_create__ ( (t->title ? pivot_value_new_user_text (t->title, SIZE_MAX) @@ -4381,7 +4379,6 @@ ctables_table_output (struct ctables *ct, struct ctables_table *t) && t->summary_specs.n > 1)); if (summary_dimension) { - printf ("summary_dimension\n"); struct pivot_dimension *d = pivot_dimension_create ( pt, t->slabels_axis, N_("Statistics")); const struct ctables_summary_spec_set *specs = &t->summary_specs; @@ -4395,7 +4392,6 @@ ctables_table_output (struct ctables *ct, struct ctables_table *t) bool categories_dimension = t->clabels_example != NULL; if (categories_dimension) { - printf ("categories_dimension\n"); struct pivot_dimension *d = pivot_dimension_create ( pt, t->label_axis[t->clabels_from_axis], t->clabels_from_axis == PIVOT_AXIS_ROW @@ -4418,9 +4414,17 @@ ctables_table_output (struct ctables *ct, struct ctables_table *t) struct pivot_dimension *d[PIVOT_N_AXES]; for (enum pivot_axis_type a = 0; a < PIVOT_N_AXES; a++) { - d[a] = NULL; - if (!t->axes[a] && a != t->summary_axis) + static const char *names[] = { + [PIVOT_AXIS_ROW] = N_("Rows"), + [PIVOT_AXIS_COLUMN] = N_("Columns"), + [PIVOT_AXIS_LAYER] = N_("Layers"), + }; + d[a] = (t->axes[a] || a == t->summary_axis + ? pivot_dimension_create (pt, a, names[a]) + : NULL); + if (!d[a]) continue; + assert (t->axes[a]); for (size_t i = 0; i < t->stacks[a].n; i++) @@ -4532,17 +4536,6 @@ ctables_table_output (struct ctables *ct, struct ctables_table *t) }; } - if (!n_levels) - goto next_free; - - static const char *names[] = { - [PIVOT_AXIS_ROW] = N_("Rows"), - [PIVOT_AXIS_COLUMN] = N_("Columns"), - [PIVOT_AXIS_LAYER] = N_("Layers"), - }; - d[a] = pivot_dimension_create (pt, a, names[a]); - printf ("%s dimension\n", names[a]); - /* Pivot categories: - variable label for nest->vars[0], if vlabel != CTVL_NONE @@ -4640,9 +4633,8 @@ ctables_table_output (struct ctables *ct, struct ctables_table *t) cell->axes[a].leaf = prev_leaf; } - free (groups); - next_free: free (sorted); + free (groups); free (levels); free (sections); } diff --git a/tests/language/stats/ctables.at b/tests/language/stats/ctables.at index a60ec46b22..726da3d723 100644 --- a/tests/language/stats/ctables.at +++ b/tests/language/stats/ctables.at @@ -2964,15 +2964,6 @@ AT_SETUP([CTABLES scale summary functions - assertion failure]) AT_CHECK([ln $top_srcdir/examples/nhtsa.sav . || cp $top_srcdir/examples/nhtsa.sav .]) AT_DATA([ctables.sps], [[GET 'nhtsa.sav'. -CTABLES - /VLABELS VARIABLE=qn19a DISPLAY=BOTH - /TABLE region BY qn19a - /CATEGORIES VARIABLES=qn19a TOTAL=YES MISSING=INCLUDE - /SLABELS POSITION=ROW. -CTABLES - /VLABELS VARIABLE=qn19a DISPLAY=NONE - /TABLE region BY qn19a - /CATEGORIES VARIABLES=qn19a TOTAL=YES MISSING=INCLUDE. CTABLES /VLABELS VARIABLE=qn19a DISPLAY=NONE /TABLE region BY qn19a -- 2.30.2