pivot-table: New functions for setting captions, etc.
[pspp] / src / language / stats / factor.c
index 4feece0da0b813018f63a36a3eb947f7214b0723..316b64a71e0b824d7b63710943b0b5a0fe8eb93d 100644 (file)
@@ -250,7 +250,7 @@ struct idata
 static struct idata *
 idata_alloc (size_t n_vars)
 {
-  struct idata *id = xzalloc (sizeof (*id));
+  struct idata *id = XZALLOC (struct idata);
 
   id->n_extractions = 0;
   id->msr = gsl_vector_alloc (n_vars);
@@ -443,7 +443,7 @@ n_extracted_factors (const struct cmd_factor *factor, struct idata *idata)
 
 
 /* Returns a newly allocated matrix identical to M.
-   It it the callers responsibility to free the returned value.
+   It is the callers responsibility to free the returned value.
 */
 static gsl_matrix *
 matrix_dup (const gsl_matrix *m)
@@ -1945,8 +1945,11 @@ show_correlation_matrix (const struct cmd_factor *factor, const struct idata *id
     }
 
   if (factor->print & PRINT_DETERMINANT)
-    table->caption = pivot_value_new_user_text_nocopy (
-      xasprintf ("%s: %.2f", _("Determinant"), idata->detR));
+    {
+      struct pivot_value *caption = pivot_value_new_user_text_nocopy (
+        xasprintf ("%s: %.2f", _("Determinant"), idata->detR));
+      pivot_table_set_caption (table, caption);
+    }
 
   pivot_table_submit (table);
 }
@@ -2014,7 +2017,7 @@ do_factor_by_matrix (const struct cmd_factor *factor, struct idata *idata)
   if (!idata->mm.cov && !(idata->mm.corr && idata->mm.var_matrix))
     {
       msg (ME, _("The dataset has no covariance matrix or a "
-                 "correlation matrix along with standard devications."));
+                 "correlation matrix along with standard deviations."));
       return;
     }