projects
/
pspp-builds.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
piechart: Fix spelling of "magnitude".
[pspp-builds.git]
/
src
/
output
/
table.c
diff --git
a/src/output/table.c
b/src/output/table.c
index 9457923ab8f8c2e517fe6e2a5a74ac27705156f0..9c931a5a3586fdfe3e267056f27e1b8a45e1e590 100644
(file)
--- a/
src/output/table.c
+++ b/
src/output/table.c
@@
-44,7
+44,6
@@
#define _(msgid) gettext (msgid)
\f
const struct som_table_class tab_table_class;
#define _(msgid) gettext (msgid)
\f
const struct som_table_class tab_table_class;
-static char *command_name;
/* Returns the font to use for a cell with the given OPTIONS. */
static enum outp_font
/* Returns the font to use for a cell with the given OPTIONS. */
static enum outp_font
@@
-62,6
+61,7
@@
tab_create (int nc, int nr, int reallocable UNUSED)
struct tab_table *t;
t = pool_create_container (struct tab_table, container);
struct tab_table *t;
t = pool_create_container (struct tab_table, container);
+ t->ref_cnt = 1;
t->col_style = TAB_COL_NONE;
t->col_group = 0;
t->title = NULL;
t->col_style = TAB_COL_NONE;
t->col_group = 0;
t->title = NULL;
@@
-86,17
+86,28
@@
tab_create (int nc, int nr, int reallocable UNUSED)
return t;
}
return t;
}
-/* Destroys table T. */
+/* Increases T's reference count and, if this causes T's
+ reference count to reach 0, destroys T. */
void
tab_destroy (struct tab_table *t)
{
void
tab_destroy (struct tab_table *t)
{
- assert (t != NULL);
+ assert (t->ref_cnt > 0);
+ if (--t->ref_cnt > 0)
+ return;
if (t->dim_free != NULL)
t->dim_free (t->dim_aux);
free (t->title);
pool_destroy (t->container);
}
if (t->dim_free != NULL)
t->dim_free (t->dim_aux);
free (t->title);
pool_destroy (t->container);
}
+/* Increases T's reference count. */
+void
+tab_ref (struct tab_table *t)
+{
+ assert (t->ref_cnt > 0);
+ t->ref_cnt++;
+}
+
/* Sets the width and height of a table, in columns and rows,
respectively. Use only to reduce the size of a table, since it
does not change the amount of allocated memory. */
/* Sets the width and height of a table, in columns and rows,
respectively. Use only to reduce the size of a table, since it
does not change the amount of allocated memory. */
@@
-1146,7
+1157,8
@@
tabi_cumulate (void *r_, int cumtype, int start, int *end,
Y. Y may be zero, or X and Y may be zero, but X should be nonzero
if Y is nonzero. */
static void
Y. Y may be zero, or X and Y may be zero, but X should be nonzero
if Y is nonzero. */
static void
-tabi_title (void *r_, int x, int y, int table_num, int subtable_num)
+tabi_title (void *r_, int x, int y, int table_num, int subtable_num,
+ const char *command_name)
{
const struct tab_rendering *r = r_;
const struct tab_table *t = r->table;
{
const struct tab_rendering *r = r_;
const struct tab_table *t = r->table;
@@
-1474,12
+1486,3
@@
render_strip (const struct tab_rendering *r,
return x;
}
return x;
}
-
-/* Sets COMMAND_NAME as the name of the current command,
- for embedding in output. */
-void
-tab_set_command_name (const char *command_name_)
-{
- free (command_name);
- command_name = command_name_ ? xstrdup (command_name_) : NULL;
-}