X-Git-Url: https://pintos-os.org/cgi-bin/gitweb.cgi?a=blobdiff_plain;f=src%2Foutput%2Ftext-item.c;h=1531656276c7dd01116eff4b094fc9933362494e;hb=43f0e5bf6c53ee0ba31b259aab230861baa4eb7e;hp=16588ae5c54e2beef6a1e96d3fbfd170a29572c3;hpb=f550aee00a62fe1d8baf62d83cd7efef6cc2ee92;p=pspp diff --git a/src/output/text-item.c b/src/output/text-item.c index 16588ae5c5..1531656276 100644 --- a/src/output/text-item.c +++ b/src/output/text-item.c @@ -1,5 +1,5 @@ /* PSPP - a program for statistical analysis. - Copyright (C) 2009 Free Software Foundation, Inc. + Copyright (C) 2009, 2010, 2011 Free Software Foundation, Inc. This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -16,24 +16,26 @@ #include -#include +#include "output/text-item.h" #include #include #include -#include -#include -#include +#include "libpspp/cast.h" +#include "output/driver.h" +#include "output/output-item-provider.h" -#include "xalloc.h" -#include "xvasprintf.h" +#include "gl/xalloc.h" +#include "gl/xvasprintf.h" #include "gettext.h" #define _(msgid) gettext (msgid) -static struct text_item * -allocate_text_item (enum text_item_type type, char *text) +/* Creates and returns a new text item containing TEXT and the specified TYPE. + The new text item takes ownership of TEXT. */ +struct text_item * +text_item_create_nocopy (enum text_item_type type, char *text) { struct text_item *item = xmalloc (sizeof *item); output_item_init (&item->output_item, &text_item_class); @@ -47,7 +49,7 @@ allocate_text_item (enum text_item_type type, char *text) struct text_item * text_item_create (enum text_item_type type, const char *text) { - return allocate_text_item (type, xstrdup (text)); + return text_item_create_nocopy (type, xstrdup (text)); } /* Creates and returns a new text item containing a copy of FORMAT, which is @@ -60,7 +62,7 @@ text_item_create_format (enum text_item_type type, const char *format, ...) va_list args; va_start (args, format); - item = allocate_text_item (type, xvasprintf (format, args)); + item = text_item_create_nocopy (type, xvasprintf (format, args)); va_end (args); return item;