From: Ben Pfaff Date: Sun, 27 Dec 2020 04:26:37 +0000 (-0800) Subject: table: Delete some functions that were unused or barely used. X-Git-Url: https://pintos-os.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=2027a4ba5ec205a650e93ee17a8840824434184f;p=pspp table: Delete some functions that were unused or barely used. --- diff --git a/src/language/data-io/print.c b/src/language/data-io/print.c index 0cb337d428..4a767dc3dc 100644 --- a/src/language/data-io/print.c +++ b/src/language/data-io/print.c @@ -563,7 +563,8 @@ print_text_flush_records (struct print_trns *trns, struct u8_line *line, *u8_line_reserve (line, 0, 1, 1) = leader; if (trns->writer == NULL) - table_output_text (TAB_FIX, ds_cstr (&line->s) + 1); + text_item_submit (text_item_create (TEXT_ITEM_LOG, + ds_cstr (&line->s) + 1)); else { size_t len = ds_length (&line->s); diff --git a/src/output/ascii.c b/src/output/ascii.c index 07b0558016..7fd2f5e876 100644 --- a/src/output/ascii.c +++ b/src/output/ascii.c @@ -481,13 +481,6 @@ ascii_output_table_item_unref (struct ascii_driver *a, table_item_unref (table_item); } -static void -ascii_output_text (struct ascii_driver *a, const char *text) -{ - ascii_output_table_item_unref ( - a, table_item_create (table_from_string (text), NULL, NULL, NULL)); -} - static void ascii_submit (struct output_driver *driver, const struct output_item *output_item) @@ -532,12 +525,11 @@ ascii_submit (struct output_driver *driver, a, text_item_to_table_item (text_item_ref (text_item))); } else if (is_message_item (output_item)) - { - const struct message_item *message_item = to_message_item (output_item); - char *s = msg_to_string (message_item_get_msg (message_item)); - ascii_output_text (a, s); - free (s); - } + ascii_output_table_item_unref ( + a, text_item_to_table_item ( + message_item_to_text_item ( + to_message_item ( + output_item_ref (output_item))))); } const struct output_driver_factory txt_driver_factory = diff --git a/src/output/table.c b/src/output/table.c index c27d208f72..4133e036d0 100644 --- a/src/output/table.c +++ b/src/output/table.c @@ -170,22 +170,6 @@ table_collect_footnotes (const struct table_item *item, return n_nonnull; } -/* Returns a table that contains a single cell, whose contents are the - left-aligned TEXT. */ -struct table * -table_from_string (const char *text) -{ - struct table *t = table_create (1, 1, 0, 0, 0, 0); - t->styles[0] = pool_alloc (t->container, sizeof *t->styles[0]); - *t->styles[0] = (struct table_area_style) { - TABLE_AREA_STYLE_INITIALIZER__, - .cell_style.halign = TABLE_HALIGN_LEFT, - .cell_style.valign = TABLE_VALIGN_TOP - }; - table_text (t, 0, 0, 0 << TAB_STYLE_SHIFT, text); - return t; -} - const char * table_halign_to_string (enum table_halign halign) { @@ -713,36 +697,6 @@ table_cell_is_empty (const struct table *table, int c, int r) return table->cc[c + r * table_nc (table)] == NULL; } -/* Editing. */ - -/* Writes STRING to the output. OPTIONS may be any valid combination of TAB_* - bits. - - This function is obsolete. Please do not add new uses of it. Instead, use - a text_item (see output/text-item.h). */ -void -table_output_text (int options UNUSED, const char *string) -{ - text_item_submit (text_item_create (TEXT_ITEM_LOG, string)); -} - -/* Same as table_output_text(), but FORMAT is passed through printf-like - formatting before output. */ -void -table_output_text_format (int options, const char *format, ...) -{ - va_list args; - char *text; - - va_start (args, format); - text = xvasprintf (format, args); - va_end (args); - - table_output_text (options, text); - - free (text); -} - /* Initializes CELL with the contents of the table cell at column X and row Y within TABLE. When CELL is no longer needed, the caller is responsible for freeing it by calling table_cell_free(CELL). diff --git a/src/output/table.h b/src/output/table.h index ed8e70123b..77315c9b9c 100644 --- a/src/output/table.h +++ b/src/output/table.h @@ -258,12 +258,6 @@ static inline int table_ht (const struct table *t) static inline int table_hb (const struct table *t) { return t->h[TABLE_VERT][1]; } -/* Simple kinds of output. */ -struct table *table_from_string (const char *); -void table_output_text (int options, const char *string); -void table_output_text_format (int options, const char *, ...) - PRINTF_FORMAT (2, 3); - /* Rule masks. */ #define TAB_RULE_TYPE_MASK 7 #define TAB_RULE_TYPE_SHIFT 0