render: Coding style fix.
[pspp] / src / output / render.c
index b514f09e85e780e61352325f21e8e00306ec83c3..08f89a177ed1cc1c3c073974923dff0f4c57e354 100644 (file)
@@ -29,7 +29,6 @@
 #include "output/pivot-output.h"
 #include "output/pivot-table.h"
 #include "output/render.h"
-#include "output/table-item.h"
 #include "output/table.h"
 
 #include "gl/minmax.h"
@@ -540,9 +539,8 @@ render_page_allocate__ (const struct render_params *params,
 
   for (int i = 0; i < TABLE_N_AXES; i++)
     {
-      page->cp[i] = xmalloc ((2 * n[i] + 2) * sizeof *page->cp[i]);
-      page->join_crossing[i] = xzalloc ((n[i] + 1)
-                                        * sizeof *page->join_crossing[i]);
+      page->cp[i] = xcalloc ((2 * n[i] + 2) , sizeof *page->cp[i]);
+      page->join_crossing[i] = xcalloc ((n[i] + 1) , sizeof *page->join_crossing[i]);
     }
 
   hmap_init (&page->overflows);
@@ -733,7 +731,7 @@ render_page_create (const struct render_params *params, struct table *table,
      span multiple columns. */
   struct render_row *columns[2];
   for (int i = 0; i < 2; i++)
-    columns[i] = xzalloc (nc * sizeof *columns[i]);
+    columns[i] = xcalloc (nc, sizeof *columns[i]);
   for (int y = 0; y < nr; y++)
     for (int x = 0; x < nc;)
       {
@@ -817,7 +815,7 @@ render_page_create (const struct render_params *params, struct table *table,
     }
 
   /* Calculate heights of cells that do not span multiple rows. */
-  struct render_row *rows = xzalloc (nr * sizeof *rows);
+  struct render_row *rows = XCALLOC (nr, struct render_row);
   for (int y = 0; y < nr; y++)
     for (int x = 0; x < nc;)
       {
@@ -1511,14 +1509,13 @@ render_pager_start_page (struct render_pager *p)
   render_break_init_empty (&p->y_break);
 }
 
-/* Creates and returns a new render_pager for rendering TABLE_ITEM on the
-   device with the given PARAMS. */
+/* Creates and returns a new render_pager for rendering PT on the device
+   with the given PARAMS. */
 struct render_pager *
 render_pager_create (const struct render_params *params,
-                     const struct table_item *table_item,
+                     const struct pivot_table *pt,
                      const size_t *layer_indexes)
 {
-  const struct pivot_table *pt = table_item->pt;
   if (!layer_indexes)
     layer_indexes = pt->current_layer;
 
@@ -1533,9 +1530,7 @@ render_pager_create (const struct render_params *params,
   double scale = 1.0;
   if (body_width > params->size[H])
     {
-      if (table_item->pt
-          && table_item->pt->look->shrink_to_fit[H]
-          && params->ops->scale)
+      if (pt->look->shrink_to_fit[H] && params->ops->scale)
         scale = params->size[H] / (double) body_width;
       else
         {
@@ -1567,9 +1562,7 @@ render_pager_create (const struct render_params *params,
      they won't break across as much vertical space, thus shrinking the table
      vertically more than the scale would imply.  Shrinking only as much as
      necessary would require an iterative search. */
-  if (table_item->pt
-      && table_item->pt->look->shrink_to_fit[V]
-      && params->ops->scale)
+  if (pt->look->shrink_to_fit[V] && params->ops->scale)
     {
       int total_height = 0;
       for (size_t i = 0; i < p->n_pages; i++)
@@ -1982,7 +1975,7 @@ static struct render_overflow *
 insert_overflow (struct render_page_selection *s,
                  const struct table_cell *cell)
 {
-  struct render_overflow *of = xzalloc (sizeof *of);
+  struct render_overflow *of = XZALLOC (struct render_overflow);
   cell_to_subpage (s, cell, of->d);
   hmap_insert (&s->subpage->overflows, &of->node,
                hash_cell (of->d[H], of->d[V]));