]> git.ipfire.org Git - thirdparty/util-linux.git/commitdiff
libsmartcols: allow to add line to table without columns
authorKarel Zak <kzak@redhat.com>
Thu, 23 Aug 2018 08:02:49 +0000 (10:02 +0200)
committerKarel Zak <kzak@redhat.com>
Thu, 23 Aug 2018 08:02:49 +0000 (10:02 +0200)
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>
libsmartcols/src/table.c

index 979a09a39739a47c7fb7f7c2bb0d1b51967e57f9..3914c88b324d953d266600dd535af2f7e035afc6 100644 (file)
@@ -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();