From b2a7697fe4675ce67f16f413700a15e26779a2ac Mon Sep 17 00:00:00 2001 From: Ben Pfaff Date: Sat, 13 Aug 2022 17:10:39 -0700 Subject: [PATCH] start making code cleaner --- src/language/stats/ctables.c | 46 +++++++++++------------------------- 1 file changed, 14 insertions(+), 32 deletions(-) diff --git a/src/language/stats/ctables.c b/src/language/stats/ctables.c index 4e872fc59f..918fed9a7b 100644 --- a/src/language/stats/ctables.c +++ b/src/language/stats/ctables.c @@ -4678,27 +4678,7 @@ ctables_prepare_table (struct ctables_table *t) continue; nest->areas[at][nest->n_areas[at]++] = k; } - else if (at == CTAT_LAYERCOL && a == PIVOT_AXIS_ROW && t->label_axis[PIVOT_AXIS_ROW] == PIVOT_AXIS_COLUMN) - { - for (size_t k = nest->n - 1; k < nest->n; k--) - { - if (k == nest->scale_idx) - continue; - nest->areas[at][nest->n_areas[at]++] = k; - break; - } - } - else if (at == CTAT_LAYERCOL && a == PIVOT_AXIS_ROW && t->label_axis[PIVOT_AXIS_ROW] == PIVOT_AXIS_LAYER) - { - for (size_t k = nest->n - 1; k < nest->n; k--) - { - if (k == nest->scale_idx) - continue; - nest->areas[at][nest->n_areas[at]++] = k; - break; - } - } - else if (at == CTAT_LAYERROW && a == PIVOT_AXIS_COLUMN && t->label_axis[PIVOT_AXIS_COLUMN] == PIVOT_AXIS_LAYER) + else if (at == CTAT_LAYERCOL && a == PIVOT_AXIS_ROW && t->label_axis[a] != a) { for (size_t k = nest->n - 1; k < nest->n; k--) { @@ -4707,8 +4687,9 @@ ctables_prepare_table (struct ctables_table *t) nest->areas[at][nest->n_areas[at]++] = k; break; } + continue; } - else if (at == CTAT_LAYERROW && a == PIVOT_AXIS_COLUMN && t->label_axis[PIVOT_AXIS_COLUMN] == PIVOT_AXIS_ROW) + else if (at == CTAT_LAYERROW && a == PIVOT_AXIS_COLUMN && t->label_axis[a] != a) { for (size_t k = nest->n - 1; k < nest->n; k--) { @@ -4717,6 +4698,7 @@ ctables_prepare_table (struct ctables_table *t) nest->areas[at][nest->n_areas[at]++] = k; break; } + continue; } else if (at == CTAT_LAYER && t->label_axis[a] == PIVOT_AXIS_LAYER) { @@ -4740,6 +4722,16 @@ ctables_prepare_table (struct ctables_table *t) nest->n_areas[at]--; continue; } + else if (at == CTAT_SUBTABLE && t->label_axis[PIVOT_AXIS_COLUMN] == PIVOT_AXIS_ROW) + { + size_t n_drop = (a == PIVOT_AXIS_LAYER ? 0 + : a == PIVOT_AXIS_COLUMN ? 2 + : 0); + for (size_t i = 0; i < n_drop; i++) + if (nest->n_areas[at] > 0) + nest->n_areas[at]--; + continue; + } else if (at == CTAT_SUBTABLE && t->label_axis[PIVOT_AXIS_ROW] == PIVOT_AXIS_LAYER) { if (a == PIVOT_AXIS_ROW) @@ -4776,16 +4768,6 @@ ctables_prepare_table (struct ctables_table *t) } continue; } - else if (at == CTAT_SUBTABLE && t->label_axis[PIVOT_AXIS_COLUMN] == PIVOT_AXIS_ROW) - { - size_t n_drop = (a == PIVOT_AXIS_LAYER ? 0 - : a == PIVOT_AXIS_COLUMN ? 2 - : 0); - for (size_t i = 0; i < n_drop; i++) - if (nest->n_areas[at] > 0) - nest->n_areas[at]--; - continue; - } else if (at == CTAT_ROW && a == PIVOT_AXIS_COLUMN && t->label_axis[PIVOT_AXIS_ROW] == PIVOT_AXIS_COLUMN) continue; else if (at == CTAT_COL && a == PIVOT_AXIS_ROW && t->label_axis[PIVOT_AXIS_ROW] == PIVOT_AXIS_COLUMN) -- 2.30.2