X-Git-Url: https://pintos-os.org/cgi-bin/gitweb.cgi?a=blobdiff_plain;f=src%2Foutput%2Foutput-item.c;h=6b7c11121c588d998e09797d569122ed1fe565fb;hb=b051ed08f170d5211f47491da71539f996ee5655;hp=25cffe460090d9e05cb30a5610f737c64ba18054;hpb=5ce9c6ba1502e623ec6723a8273da77e5858b8d4;p=pspp diff --git a/src/output/output-item.c b/src/output/output-item.c index 25cffe4600..6b7c11121c 100644 --- a/src/output/output-item.c +++ b/src/output/output-item.c @@ -86,6 +86,7 @@ output_item_unref (struct output_item *item) case OUTPUT_ITEM_GROUP: for (size_t i = 0; i < item->group.n_children; i++) output_item_unref (item->group.children[i]); + free (item->group.children); break; case OUTPUT_ITEM_IMAGE: @@ -164,7 +165,7 @@ output_item_unshare (struct output_item *old) = old->group.n_children; for (size_t i = 0; i < new->group.n_children; i++) - output_item_ref (new->group.children[i]); + new->group.children[i] = output_item_ref (new->group.children[i]); break; case OUTPUT_ITEM_IMAGE: @@ -359,13 +360,17 @@ output_item_dump (const struct output_item *item, int indentation) break; case OUTPUT_ITEM_TABLE: + printf ("table\n"); pivot_table_dump (item->table, indentation + 1); break; case OUTPUT_ITEM_TEXT: - printf ("text %s \"%s\"\n", - text_item_subtype_to_string (item->text.subtype), - pivot_value_to_string_defaults (item->text.content)); + { + char *s = pivot_value_to_string (item->text.content, NULL); + printf ("text %s \"%s\"\n", + text_item_subtype_to_string (item->text.subtype), s); + free (s); + } break; } } @@ -597,7 +602,7 @@ text_item_create_value (enum text_item_subtype subtype, ex->font_style->typeface = xstrdup ("Monospaced"); } - struct output_item *item = xzalloc (sizeof *item); + struct output_item *item = XZALLOC (struct output_item); *item = (struct output_item) { OUTPUT_ITEM_INITIALIZER (OUTPUT_ITEM_TEXT), .command_name = xstrdup_if_nonnull (output_get_command_name ()), @@ -620,7 +625,7 @@ char * text_item_get_plain_text (const struct output_item *item) { assert (item->type == OUTPUT_ITEM_TEXT); - return pivot_value_to_string_defaults (item->text.content); + return pivot_value_to_string (item->text.content, NULL); } static bool