Signed-off-by: Karel Zak <kzak@redhat.com>
INIT_LIST_HEAD(&tb->tb_lines);
INIT_LIST_HEAD(&tb->tb_columns);
- if (scols_table_set_symbols(tb, syms) == 0)
- return tb;
+ if (syms && scols_table_set_symbols(tb, syms) != 0)
+ goto err;
+ return tb;
+err:
scols_unref_table(tb);
return NULL;
}
if (!tb)
return -1;
+ if (!tb->symbols)
+ scols_table_set_symbols(tb, NULL); /* use default */
+
tb->is_term = isatty(STDOUT_FILENO);
tb->termwidth = tb->is_term ? get_terminal_width() : 0;
if (tb->termwidth <= 0)