From: Ben Pfaff Date: Tue, 29 Dec 2020 07:35:45 +0000 (-0800) Subject: table-item: Remove barely used parameters from table_item_create(). X-Git-Url: https://pintos-os.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=7e5488beb1b0bc2dcaf598a765294c6d5db0e151;p=pspp table-item: Remove barely used parameters from table_item_create(). The 'title' and 'caption' parameters were always NULL in practice, and only one caller supplied nonnull 'notes'. --- diff --git a/src/output/pivot-output.c b/src/output/pivot-output.c index ae12c4dea3..1488519ee2 100644 --- a/src/output/pivot-output.c +++ b/src/output/pivot-output.c @@ -455,7 +455,10 @@ pivot_table_submit_layer (const struct pivot_table *pt, free (column_enumeration); free (row_enumeration); - struct table_item *ti = table_item_create (table, NULL, NULL, pt->notes); + struct table_item *ti = table_item_create (table); + + if (pt->notes) + table_item_set_notes (ti, pt->notes); if (pt->title) { diff --git a/src/output/table-item.c b/src/output/table-item.c index 1b17c320a6..bc154d5462 100644 --- a/src/output/table-item.c +++ b/src/output/table-item.c @@ -122,20 +122,15 @@ table_item_layers_destroy (struct table_item_layers *layers) } } -/* Initializes ITEM as a table item for rendering TABLE. The new table item - initially has the specified TITLE, CAPTION, and NOTES, which may each be - NULL. The caller retains ownership of TITLE, CAPTION, and NOTES. */ +/* Initializes ITEM as a table item for rendering TABLE. Takes ownership of + TABLE. */ struct table_item * -table_item_create (struct table *table, const char *title, const char *caption, - const char *notes) +table_item_create (struct table *table) { struct table_item *item = xmalloc (sizeof *item); *item = (struct table_item) { .output_item = OUTPUT_ITEM_INITIALIZER (&table_item_class), .table = table, - .title = table_item_text_create (title), - .caption = table_item_text_create (caption), - .notes = notes ? xstrdup (notes) : NULL, }; return item; } diff --git a/src/output/table-item.h b/src/output/table-item.h index d1c30b668d..a4435a0f59 100644 --- a/src/output/table-item.h +++ b/src/output/table-item.h @@ -79,8 +79,7 @@ struct table_item struct pivot_table *pt; }; -struct table_item *table_item_create (struct table *, const char *title, - const char *caption, const char *notes); +struct table_item *table_item_create (struct table *); const struct table *table_item_get_table (const struct table_item *); diff --git a/src/output/text-item.c b/src/output/text-item.c index 55319e9ef6..2f0cef5ee7 100644 --- a/src/output/text-item.c +++ b/src/output/text-item.c @@ -185,7 +185,7 @@ text_item_to_table_item (struct text_item *text_item) if (text_item->type == TEXT_ITEM_SYNTAX || text_item->type == TEXT_ITEM_LOG) opts |= TAB_FIX; table_text (tab, 0, 0, opts, text_item_get_text (text_item)); - struct table_item *table_item = table_item_create (tab, NULL, NULL, NULL); + struct table_item *table_item = table_item_create (tab); text_item_unref (text_item); return table_item; } diff --git a/tests/output/render-test.c b/tests/output/render-test.c index d9ca79603a..c382ee12c5 100644 --- a/tests/output/render-test.c +++ b/tests/output/render-test.c @@ -114,7 +114,7 @@ main (int argc, char **argv) } table = tables[n_tables - 1]; - table_item_submit (table_item_create (table, NULL, NULL, NULL)); + table_item_submit (table_item_create (table)); free (tables); } else