output: Rename a few struct members for consistency.
[pspp] / src / output / table.c
index 44efa3abc34f1fc379356598742212dca7ed6b10..f909bf3ade90f925be4b13f70762a8a3ee0c8c1b 100644 (file)
@@ -24,6 +24,7 @@
 
 #include "libpspp/cast.h"
 #include "libpspp/compiler.h"
+#include "libpspp/pool.h"
 #include "libpspp/str.h"
 #include "output/table-item.h"
 
@@ -130,12 +131,12 @@ table_set_nr (struct table *table, int nr)
 }
 \f
 struct cell_style *
-cell_style_clone (const struct cell_style *old)
+cell_style_clone (struct pool *pool, const struct cell_style *old)
 {
-  struct cell_style *new = xmalloc (sizeof *new);
+  struct cell_style *new = pool_malloc (pool, sizeof *new);
   *new = *old;
-  if (new->font)
-    new->font = strdup (new->font);
+  if (new->typeface)
+    new->typeface = pool_strdup (pool, new->typeface);
   return new;
 }
 
@@ -144,7 +145,7 @@ cell_style_free (struct cell_style *style)
 {
   if (style)
     {
-      free (style->font);
+      free (style->typeface);
       free (style);
     }
 }
@@ -224,14 +225,14 @@ table_get_rule (const struct table *table, enum table_axis axis, int x, int y,
 }
 
 void
-cell_contents_format_footnote_markers (const struct cell_contents *c,
-                                       struct string *s)
+table_cell_format_footnote_markers (const struct table_cell *cell,
+                                    struct string *s)
 {
-  for (size_t i = 0; i < c->n_footnotes; i++)
+  for (size_t i = 0; i < cell->n_footnotes; i++)
     {
       if (i)
         ds_put_byte (s, ',');
-      ds_put_cstr (s, c->footnotes[i]->marker);
+      ds_put_cstr (s, cell->footnotes[i]->marker);
     }
 }
 
@@ -273,12 +274,8 @@ table_collect_footnotes (const struct table_item *item,
           table_get_cell (t, x, y, &cell);
 
           if (x == cell.d[TABLE_HORZ][0] && y == cell.d[TABLE_VERT][0])
-            for (size_t i = 0; i < cell.n_contents; i++)
-              {
-                const struct cell_contents *c = &cell.contents[i];
-                footnotes = add_footnotes (c->footnotes, c->n_footnotes,
-                                           footnotes, &allocated, &n);
-              }
+            footnotes = add_footnotes (cell.footnotes, cell.n_footnotes,
+                                       footnotes, &allocated, &n);
           table_cell_free (&cell);
         }
     }
@@ -419,11 +416,9 @@ table_string_get_cell (const struct table *ts_, int x UNUSED, int y UNUSED,
   cell->d[TABLE_HORZ][1] = 1;
   cell->d[TABLE_VERT][0] = 0;
   cell->d[TABLE_VERT][1] = 1;
-  cell->contents = &cell->inline_contents;
-  cell->inline_contents.options = ts->options;
-  cell->inline_contents.text = ts->string;
-  cell->inline_contents.n_footnotes = 0;
-  cell->n_contents = 1;
+  cell->options = ts->options;
+  cell->text = ts->string;
+  cell->n_footnotes = 0;
   cell->destructor = NULL;
 }