From 730a91c26a1e867a98458066b18e3be6a93be089 Mon Sep 17 00:00:00 2001 From: Robert Kessl Date: Tue, 8 Jul 2014 13:40:57 +0200 Subject: [PATCH] tableprinter: allocation of handles now uses xmalloc_zero/xfree --- ucw/table.c | 7 ++----- ucw/table.h | 4 +--- 2 files changed, 3 insertions(+), 8 deletions(-) diff --git a/ucw/table.c b/ucw/table.c index 0f1490cb..20463467 100644 --- a/ucw/table.c +++ b/ucw/table.c @@ -22,7 +22,7 @@ static void table_update_ll(struct table *tbl); static struct table *table_template_copy(struct table_template *tbl_template) { - struct table *copy = mp_alloc_zero(tbl_template->pool, sizeof(struct table)); + struct table *copy = xmalloc_zero(sizeof(struct table)); copy->column_count = tbl_template->column_count; copy->pool = mp_new(4096); @@ -55,10 +55,6 @@ struct table *table_init(struct table_template *tbl_template) { int col_count = 0; // count the number of columns in the struct table - if(!tbl_template->pool) { - tbl_template->pool = mp_new(4096); - } - struct table *tbl = table_template_copy(tbl_template); for(;;) { @@ -88,6 +84,7 @@ void table_cleanup(struct table *tbl) { mp_delete(tbl->pool); memset(tbl, 0, sizeof(struct table)); + xfree(tbl); } // TODO: test default column order diff --git a/ucw/table.h b/ucw/table.h index 96a5b051..5b95905d 100644 --- a/ucw/table.h +++ b/ucw/table.h @@ -73,7 +73,7 @@ * ----------------- ***/ -// FIXME: update documentation according to the changes made in recent comments! +// FIXME: update documentation according to the changes made in recent commits! /** Types of columns. These are seldom used explicitly, using a column definition macro is preferred. **/ enum column_type { @@ -150,8 +150,6 @@ struct table_template { const char *col_delimiter; // [*] Delimiter that is placed between columns // Back-end used for table formatting and its private data struct table_formatter *formatter; - - struct mempool *pool; // Memory pool used for storing table handles. }; /** -- 2.39.5