summaryrefslogtreecommitdiffstats
path: root/libsmartcols
diff options
context:
space:
mode:
authorKarel Zak2018-08-23 10:02:49 +0200
committerKarel Zak2018-08-23 10:02:49 +0200
commitc434b2782c20f3d8756bf3944012badc63128062 (patch)
tree00227803d130a899c2beb581422caaddc1e40926 /libsmartcols
parentsetpriv: add --reset-env (diff)
downloadkernel-qcow2-util-linux-c434b2782c20f3d8756bf3944012badc63128062.tar.gz
kernel-qcow2-util-linux-c434b2782c20f3d8756bf3944012badc63128062.tar.xz
kernel-qcow2-util-linux-c434b2782c20f3d8756bf3944012badc63128062.zip
libsmartcols: allow to add line to table without columns
The table allows to add columns on the fly when lines already exist. So, it does not make sense to reject request to add line to table without columns. Signed-off-by: Karel Zak <kzak@redhat.com>
Diffstat (limited to 'libsmartcols')
-rw-r--r--libsmartcols/src/table.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/libsmartcols/src/table.c b/libsmartcols/src/table.c
index 979a09a39..3914c88b3 100644
--- a/libsmartcols/src/table.c
+++ b/libsmartcols/src/table.c
@@ -548,7 +548,7 @@ struct libscols_column *scols_table_get_column(struct libscols_table *tb,
*/
int scols_table_add_line(struct libscols_table *tb, struct libscols_line *ln)
{
- if (!tb || !ln || tb->ncols == 0)
+ if (!tb || !ln)
return -EINVAL;
if (tb->ncols > ln->ncells) {
@@ -657,7 +657,7 @@ struct libscols_line *scols_table_new_line(struct libscols_table *tb,
{
struct libscols_line *ln;
- if (!tb || !tb->ncols)
+ if (!tb)
return NULL;
ln = scols_new_line();