summaryrefslogtreecommitdiffstats
path: root/libsmartcols/src/table.c
diff options
context:
space:
mode:
authorIgor Gnatenko2016-01-16 22:51:52 +0100
committerIgor Gnatenko2016-01-17 09:44:09 +0100
commitd10fa7e6dd2b936edcfc5e6ab78687e60e57b46a (patch)
treeedcff3a9bca0f529f89cf53b0d3632cde3af9226 /libsmartcols/src/table.c
parentfstrim: add reference to blkdiscard (diff)
downloadkernel-qcow2-util-linux-d10fa7e6dd2b936edcfc5e6ab78687e60e57b46a.tar.gz
kernel-qcow2-util-linux-d10fa7e6dd2b936edcfc5e6ab78687e60e57b46a.tar.xz
kernel-qcow2-util-linux-d10fa7e6dd2b936edcfc5e6ab78687e60e57b46a.zip
libsmartcols: reflect changinging SCOLS_FL_TREE after adding to table
When scols_column_set_flags() is called we will compare before & after status of SCOLS_FL_TREE flag and appropriately handle tb->ntreecols. Reference: https://github.com/karelzak/util-linux/issues/254 Signed-off-by: Igor Gnatenko <i.gnatenko.brain@gmail.com>
Diffstat (limited to 'libsmartcols/src/table.c')
-rw-r--r--libsmartcols/src/table.c2
1 files changed, 2 insertions, 0 deletions
diff --git a/libsmartcols/src/table.c b/libsmartcols/src/table.c
index cb4cfae0d..3360d525b 100644
--- a/libsmartcols/src/table.c
+++ b/libsmartcols/src/table.c
@@ -141,6 +141,7 @@ int scols_table_add_column(struct libscols_table *tb, struct libscols_column *cl
DBG(TAB, ul_debugobj(tb, "add column %p", cl));
list_add_tail(&cl->cl_columns, &tb->tb_columns);
cl->seqnum = tb->ncols++;
+ cl->table = tb;
scols_ref_column(cl);
/* TODO:
@@ -173,6 +174,7 @@ int scols_table_remove_column(struct libscols_table *tb,
DBG(TAB, ul_debugobj(tb, "remove column %p", cl));
list_del_init(&cl->cl_columns);
tb->ncols--;
+ cl->table = NULL;
scols_unref_column(cl);
return 0;
}