improve naming
authorBen Pfaff <blp@cs.stanford.edu>
Sat, 15 Jan 2022 05:06:17 +0000 (21:06 -0800)
committerBen Pfaff <blp@cs.stanford.edu>
Sat, 15 Jan 2022 05:06:17 +0000 (21:06 -0800)
src/language/stats/ctables.c

index 2e0b51334f2aac778662163650a56a342e991236..510efcd5cd224df0ed4eb4f9a279f68fcf0fe88f 100644 (file)
@@ -279,7 +279,7 @@ enum ctables_label_position
 
 struct ctables_summary_spec_set
   {
-    struct ctables_summary_spec *summaries;
+    struct ctables_summary_spec *specs;
     size_t n;
     size_t allocated;
 
@@ -546,8 +546,8 @@ static void
 ctables_summary_spec_set_uninit (struct ctables_summary_spec_set *set)
 {
   for (size_t i = 0; i < set->n; i++)
-    ctables_summary_spec_uninit (&set->summaries[i]);
-  free (set->summaries);
+    ctables_summary_spec_uninit (&set->specs[i]);
+  free (set->specs);
 }
 
 static bool
@@ -773,10 +773,10 @@ add_summary_spec (struct ctables_axis *axis,
       struct ctables_summary_spec_set *set = (totals ? &axis->total_sss
                                               : &axis->cell_sss);
       if (set->n >= set->allocated)
-        set->summaries = x2nrealloc (set->summaries, &set->allocated,
-                                     sizeof *set->summaries);
+        set->specs = x2nrealloc (set->specs, &set->allocated,
+                                 sizeof *set->specs);
 
-      struct ctables_summary_spec *dst = &set->summaries[set->n++];
+      struct ctables_summary_spec *dst = &set->specs[set->n++];
       *dst = (struct ctables_summary_spec) {
         .function = function,
         .percentile = percentile,
@@ -2288,7 +2288,7 @@ ctables_cell_insert__ (struct ctables_table *t, const struct ccase *c,
       = (cell->total ? &ss->total_sss : &ss->cell_sss);
     cell->summaries = xmalloc (sss->n * sizeof *cell->summaries);
     for (size_t i = 0; i < sss->n; i++)
-      ctables_summary_init (&cell->summaries[i], &sss->summaries[i]);
+      ctables_summary_init (&cell->summaries[i], &sss->specs[i]);
   }
   for (enum ctables_domain_type dt = 0; dt < N_CTDTS; dt++)
     cell->domains[dt] = ctables_domain_insert (t, cell, dt);
@@ -2308,7 +2308,7 @@ ctables_cell_add__ (struct ctables_table *t, const struct ccase *c,
   const struct ctables_summary_spec_set *sss
     = (cell->total ? &ss->total_sss : &ss->cell_sss);
   for (size_t i = 0; i < sss->n; i++)
-    ctables_summary_add (&cell->summaries[i], &sss->summaries[i], sss->var,
+    ctables_summary_add (&cell->summaries[i], &sss->specs[i], sss->var,
                          case_data (c, sss->var), weight);
   for (enum ctables_domain_type dt = 0; dt < N_CTDTS; dt++)
     cell->domains[dt]->valid += weight;
@@ -2480,14 +2480,14 @@ ctables_execute (struct dataset *ds, struct ctables *ct)
           if (!nest->cell_sss.n)
             {
               struct ctables_summary_spec_set *sss = &nest->cell_sss;
-              sss->summaries = xmalloc (sizeof *sss->summaries);
+              sss->specs = xmalloc (sizeof *sss->specs);
               sss->n = 1;
 
               enum ctables_summary_function function
                 = sss->var ? CTSF_MEAN : CTSF_COUNT;
               struct ctables_var var = { .is_mrset = false, .var = sss->var };
 
-              *sss->summaries = (struct ctables_summary_spec) {
+              *sss->specs = (struct ctables_summary_spec) {
                 .function = function,
                 .format = ctables_summary_default_format (function, &var),
                 .label = ctables_summary_default_label (function, 0),
@@ -2644,7 +2644,7 @@ ctables_execute (struct dataset *ds, struct ctables *ct)
                           for (size_t m = 0; m < sss->n; m++)
                             {
                               int leaf = pivot_category_create_leaf (
-                                parent, pivot_value_new_text (sss->summaries[m].label));
+                                parent, pivot_value_new_text (sss->specs[m].label));
                               if (m == 0)
                                 prev_leaf = leaf;
                             }
@@ -2697,9 +2697,9 @@ ctables_execute (struct dataset *ds, struct ctables *ct)
                     dindexes[n_dindexes++] = leaf;
                   }
 
-              double d = ctables_summary_value (cell, &cell->summaries[j], &sss->summaries[j]);
+              double d = ctables_summary_value (cell, &cell->summaries[j], &sss->specs[j]);
               struct pivot_value *value = pivot_value_new_number (d);
-              value->numeric.format = sss->summaries[j].format;
+              value->numeric.format = sss->specs[j].format;
               pivot_table_put (pt, dindexes, n_dindexes, value);
             }
         }