crosstabs: Remove write-only variable.
[pspp-builds.git] / src / language / stats / crosstabs.q
index e296da2d61da1e7307238f76772d8071eb6af2fb..c18c3a960ec3c223c31292c642df72a102d0f4e4 100644 (file)
@@ -1218,10 +1218,17 @@ create_crosstab_table (struct crosstabs_proc *proc, struct pivot_table *pt)
   for (i = 0; i < pt->n_consts; i++)
     {
       const struct variable *var = pt->const_vars[i];
+      size_t ofs;
+
       ds_put_format (&title, ", %s=", var_get_name (var));
+
+      /* Insert the formatted value of the variable, then trim
+         leading spaces in what was just inserted. */
+      ofs = ds_length (&title);
       data_out (&pt->const_values[i], var_get_print_format (var),
                 ds_put_uninit (&title, var_get_width (var)));
-      /* XXX remove any leading space in what was just inserted.  */
+      ds_remove (&title, ofs, ss_cspan (ds_substr (&title, ofs, SIZE_MAX),
+                                        ss_cstr (" ")));
     }
 
   ds_put_cstr (&title, " [");
@@ -1264,7 +1271,6 @@ create_chisq_table (struct pivot_table *pt)
             _("Exact. Sig. (2-sided)"));
   tab_text (chisq, 5, 0, TAB_RIGHT | TAT_TITLE,
             _("Exact. Sig. (1-sided)"));
-  chisq = 0;
   tab_offset (chisq, 0, 1);
 
   return chisq;
@@ -1809,7 +1815,6 @@ display_chisq (struct pivot_table *pt, struct tab_table *chisq,
   double chisq_v[N_CHISQ];
   double fisher1, fisher2;
   int df[N_CHISQ];
-  int s = 0;
 
   int i;
 
@@ -1822,7 +1827,6 @@ display_chisq (struct pivot_table *pt, struct tab_table *chisq,
       if ((i != 2 && chisq_v[i] == SYSMIS)
          || (i == 2 && fisher1 == SYSMIS))
        continue;
-      s = 1;
 
       tab_text (chisq, 0, 0, TAB_LEFT, gettext (chisq_stats[i]));
       if (i != 2)