summaryrefslogtreecommitdiffstats
path: root/libsmartcols/src/table_print.c
diff options
context:
space:
mode:
authorKarel Zak2015-12-10 13:02:03 +0100
committerKarel Zak2015-12-10 13:02:03 +0100
commit6d6b6d185e7427e2b5590349edd76d019b0fe920 (patch)
treec939298915cfafd1da489166f3990213ddaccf40 /libsmartcols/src/table_print.c
parentlibmount: add comment, remove TODO item (diff)
downloadkernel-qcow2-util-linux-6d6b6d185e7427e2b5590349edd76d019b0fe920.tar.gz
kernel-qcow2-util-linux-6d6b6d185e7427e2b5590349edd76d019b0fe920.tar.xz
kernel-qcow2-util-linux-6d6b6d185e7427e2b5590349edd76d019b0fe920.zip
libsmartcols: add SCOLS_FL_HIDDEN
Export "don't print this column" functionality by public API. Signed-off-by: Karel Zak <kzak@redhat.com>
Diffstat (limited to 'libsmartcols/src/table_print.c')
-rw-r--r--libsmartcols/src/table_print.c10
1 files changed, 5 insertions, 5 deletions
diff --git a/libsmartcols/src/table_print.c b/libsmartcols/src/table_print.c
index d275ad640..caae98c14 100644
--- a/libsmartcols/src/table_print.c
+++ b/libsmartcols/src/table_print.c
@@ -185,7 +185,7 @@ static int is_last_column(struct libscols_table *tb, struct libscols_column *cl)
return 1;
next = list_entry(cl->cl_columns.next, struct libscols_column, cl_columns);
- if (next && next->ignore)
+ if (next && scols_column_is_hidden(next))
return 1;
return 0;
}
@@ -532,7 +532,7 @@ static int print_line(struct libscols_table *tb,
scols_reset_iter(&itr, SCOLS_ITER_FORWARD);
while (rc == 0 && scols_table_next_column(tb, &itr, &cl) == 0) {
- if (cl->ignore)
+ if (scols_column_is_hidden(cl))
continue;
rc = cell_to_buffer(tb, ln, cl, buf);
if (!rc)
@@ -563,7 +563,7 @@ static int print_header(struct libscols_table *tb, struct libscols_buffer *buf)
/* set the width according to the size of the data */
scols_reset_iter(&itr, SCOLS_ITER_FORWARD);
while (rc == 0 && scols_table_next_column(tb, &itr, &cl) == 0) {
- if (cl->ignore)
+ if (scols_column_is_hidden(cl))
continue;
rc = buffer_set_data(buf, scols_cell_get_data(&cl->header));
if (!rc)
@@ -660,7 +660,7 @@ static int print_tree(struct libscols_table *tb, struct libscols_buffer *buf)
static void dbg_column(struct libscols_table *tb, struct libscols_column *cl)
{
- if (cl->ignore) {
+ if (scols_column_is_hidden(cl)) {
DBG(COL, ul_debugobj(cl, "%s ignored", cl->header.data));
return;
}
@@ -949,7 +949,7 @@ static int recount_widths(struct libscols_table *tb, struct libscols_buffer *buf
cl->width -= r;
width -= r;
} else {
- cl->ignore = 1;
+ cl->flags |= SCOLS_FL_HIDDEN;
width -= cl->width + 1; /* +1 means separator between columns */
}
}