From 4599b4165d75ca6afa7eeac7248ba0896645c28f Mon Sep 17 00:00:00 2001 From: Robert Kessl Date: Tue, 29 Jul 2014 13:55:52 +0200 Subject: [PATCH] tableprinter: update of comments and code cleanup --- ucw/table.c | 4 ++-- ucw/table.h | 13 ++++++++++--- 2 files changed, 12 insertions(+), 5 deletions(-) diff --git a/ucw/table.c b/ucw/table.c index 1e2cabb8..499b0124 100644 --- a/ucw/table.c +++ b/ucw/table.c @@ -199,9 +199,9 @@ void table_set_col_order(struct table *tbl, const struct table_col_instance *col bool table_col_is_printed(struct table *tbl, uint col_def_idx) { - if(tbl->ll_headers[col_def_idx] == -1) return 0; + if(tbl->ll_headers[col_def_idx] == -1) return false; - return 1; + return true; } static char * table_parse_col_arg(char *col_def) diff --git a/ucw/table.h b/ucw/table.h index cc8ba985..6bcc1334 100644 --- a/ucw/table.h +++ b/ucw/table.h @@ -86,12 +86,19 @@ struct table_column { // instance to which the @col_opt is set. Return value is the error string. }; +/** + * Definition of a column instance. The table_col_instance belongs to a struct table. col_def is + * pointing to a definition of the column in struct table::columns. The user can fill only the @idx + * and @fmt. The @col_def, @cell_content, @next_column are private fields. + * + * Please use only fields marked with `[*]`. + **/ struct table_col_instance { - uint idx; // idx is a index into struct table::columns + uint idx; // [*] idx is a index into struct table::columns const struct table_column *col_def; // this is pointer to the column definition, located in the array struct table::columns const char *cell_content; // content of the cell of the current row int next_column; // index of next column in linked list of columns of the same type - uint fmt; // format of this column + uint fmt; // [*] format of this column }; /** @@ -344,7 +351,7 @@ void table_set_col_order(struct table *tbl, const struct table_col_instance *col const char *table_set_col_order_by_name(struct table *tbl, const char *col_order); /** - * Returns true if col_idx will be printed, false otherwise. + * Returns true if @col_def_idx will be printed, false otherwise. **/ bool table_col_is_printed(struct table *tbl, uint col_def_idx); -- 2.39.2