libsmartcols: remove assert(arg) from public functions
Reported-by: Mike Frysinger <vapier@gentoo.org> Signed-off-by: Karel Zak <kzak@redhat.com>
This commit is contained in:
parent
ff5ace78d6
commit
323da9ce47
|
@ -41,8 +41,6 @@
|
||||||
*/
|
*/
|
||||||
int scols_reset_cell(struct libscols_cell *ce)
|
int scols_reset_cell(struct libscols_cell *ce)
|
||||||
{
|
{
|
||||||
assert(ce);
|
|
||||||
|
|
||||||
if (!ce)
|
if (!ce)
|
||||||
return -EINVAL;
|
return -EINVAL;
|
||||||
|
|
||||||
|
@ -66,8 +64,6 @@ int scols_cell_set_data(struct libscols_cell *ce, const char *str)
|
||||||
{
|
{
|
||||||
char *p = NULL;
|
char *p = NULL;
|
||||||
|
|
||||||
assert(ce);
|
|
||||||
|
|
||||||
if (!ce)
|
if (!ce)
|
||||||
return -EINVAL;
|
return -EINVAL;
|
||||||
if (str) {
|
if (str) {
|
||||||
|
@ -94,8 +90,6 @@ int scols_cell_set_data(struct libscols_cell *ce, const char *str)
|
||||||
*/
|
*/
|
||||||
int scols_cell_refer_data(struct libscols_cell *ce, char *str)
|
int scols_cell_refer_data(struct libscols_cell *ce, char *str)
|
||||||
{
|
{
|
||||||
assert(ce);
|
|
||||||
|
|
||||||
if (!ce)
|
if (!ce)
|
||||||
return -EINVAL;
|
return -EINVAL;
|
||||||
free(ce->data);
|
free(ce->data);
|
||||||
|
@ -111,7 +105,6 @@ int scols_cell_refer_data(struct libscols_cell *ce, char *str)
|
||||||
*/
|
*/
|
||||||
const char *scols_cell_get_data(const struct libscols_cell *ce)
|
const char *scols_cell_get_data(const struct libscols_cell *ce)
|
||||||
{
|
{
|
||||||
assert(ce);
|
|
||||||
return ce ? ce->data : NULL;
|
return ce ? ce->data : NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -124,8 +117,6 @@ const char *scols_cell_get_data(const struct libscols_cell *ce)
|
||||||
*/
|
*/
|
||||||
int scols_cell_set_userdata(struct libscols_cell *ce, void *data)
|
int scols_cell_set_userdata(struct libscols_cell *ce, void *data)
|
||||||
{
|
{
|
||||||
assert(ce);
|
|
||||||
|
|
||||||
if (!ce)
|
if (!ce)
|
||||||
return -EINVAL;
|
return -EINVAL;
|
||||||
ce->userdata = data;
|
ce->userdata = data;
|
||||||
|
@ -188,8 +179,6 @@ int scols_cell_set_color(struct libscols_cell *ce, const char *color)
|
||||||
{
|
{
|
||||||
char *p = NULL;
|
char *p = NULL;
|
||||||
|
|
||||||
assert(ce);
|
|
||||||
|
|
||||||
if (!ce)
|
if (!ce)
|
||||||
return -EINVAL;
|
return -EINVAL;
|
||||||
if (color) {
|
if (color) {
|
||||||
|
@ -216,7 +205,6 @@ int scols_cell_set_color(struct libscols_cell *ce, const char *color)
|
||||||
*/
|
*/
|
||||||
const char *scols_cell_get_color(const struct libscols_cell *ce)
|
const char *scols_cell_get_color(const struct libscols_cell *ce)
|
||||||
{
|
{
|
||||||
assert(ce);
|
|
||||||
return ce ? ce->color : NULL;
|
return ce ? ce->color : NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -234,9 +222,6 @@ int scols_cell_copy_content(struct libscols_cell *dest,
|
||||||
{
|
{
|
||||||
int rc;
|
int rc;
|
||||||
|
|
||||||
assert(dest);
|
|
||||||
assert(src);
|
|
||||||
|
|
||||||
rc = scols_cell_set_data(dest, scols_cell_get_data(src));
|
rc = scols_cell_set_data(dest, scols_cell_get_data(src));
|
||||||
if (!rc)
|
if (!rc)
|
||||||
rc = scols_cell_set_color(dest, scols_cell_get_color(src));
|
rc = scols_cell_set_color(dest, scols_cell_get_color(src));
|
||||||
|
|
|
@ -86,7 +86,6 @@ struct libscols_column *scols_copy_column(const struct libscols_column *cl)
|
||||||
{
|
{
|
||||||
struct libscols_column *ret;
|
struct libscols_column *ret;
|
||||||
|
|
||||||
assert (cl);
|
|
||||||
if (!cl)
|
if (!cl)
|
||||||
return NULL;
|
return NULL;
|
||||||
ret = scols_new_column();
|
ret = scols_new_column();
|
||||||
|
@ -125,8 +124,6 @@ err:
|
||||||
*/
|
*/
|
||||||
int scols_column_set_whint(struct libscols_column *cl, double whint)
|
int scols_column_set_whint(struct libscols_column *cl, double whint)
|
||||||
{
|
{
|
||||||
assert(cl);
|
|
||||||
|
|
||||||
if (!cl)
|
if (!cl)
|
||||||
return -EINVAL;
|
return -EINVAL;
|
||||||
|
|
||||||
|
@ -157,8 +154,6 @@ double scols_column_get_whint(struct libscols_column *cl)
|
||||||
*/
|
*/
|
||||||
int scols_column_set_flags(struct libscols_column *cl, int flags)
|
int scols_column_set_flags(struct libscols_column *cl, int flags)
|
||||||
{
|
{
|
||||||
assert(cl);
|
|
||||||
|
|
||||||
if (!cl)
|
if (!cl)
|
||||||
return -EINVAL;
|
return -EINVAL;
|
||||||
|
|
||||||
|
@ -187,7 +182,6 @@ int scols_column_get_flags(struct libscols_column *cl)
|
||||||
*/
|
*/
|
||||||
struct libscols_cell *scols_column_get_header(struct libscols_column *cl)
|
struct libscols_cell *scols_column_get_header(struct libscols_column *cl)
|
||||||
{
|
{
|
||||||
assert(cl);
|
|
||||||
return cl ? &cl->header : NULL;
|
return cl ? &cl->header : NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -210,7 +204,6 @@ int scols_column_set_color(struct libscols_column *cl, const char *color)
|
||||||
{
|
{
|
||||||
char *p = NULL;
|
char *p = NULL;
|
||||||
|
|
||||||
assert(cl);
|
|
||||||
if (!cl)
|
if (!cl)
|
||||||
return -EINVAL;
|
return -EINVAL;
|
||||||
if (color) {
|
if (color) {
|
||||||
|
@ -257,7 +250,6 @@ int scols_column_set_cmpfunc(struct libscols_column *cl,
|
||||||
void *),
|
void *),
|
||||||
void *data)
|
void *data)
|
||||||
{
|
{
|
||||||
assert(cl);
|
|
||||||
if (!cl)
|
if (!cl)
|
||||||
return -EINVAL;
|
return -EINVAL;
|
||||||
|
|
||||||
|
@ -276,7 +268,6 @@ int scols_column_set_cmpfunc(struct libscols_column *cl,
|
||||||
*/
|
*/
|
||||||
int scols_column_is_trunc(struct libscols_column *cl)
|
int scols_column_is_trunc(struct libscols_column *cl)
|
||||||
{
|
{
|
||||||
assert(cl);
|
|
||||||
if (!cl)
|
if (!cl)
|
||||||
return -EINVAL;
|
return -EINVAL;
|
||||||
return cl->flags & SCOLS_FL_TRUNC;
|
return cl->flags & SCOLS_FL_TRUNC;
|
||||||
|
@ -291,7 +282,6 @@ int scols_column_is_trunc(struct libscols_column *cl)
|
||||||
*/
|
*/
|
||||||
int scols_column_is_tree(struct libscols_column *cl)
|
int scols_column_is_tree(struct libscols_column *cl)
|
||||||
{
|
{
|
||||||
assert(cl);
|
|
||||||
if (!cl)
|
if (!cl)
|
||||||
return -EINVAL;
|
return -EINVAL;
|
||||||
return cl->flags & SCOLS_FL_TREE;
|
return cl->flags & SCOLS_FL_TREE;
|
||||||
|
@ -306,7 +296,6 @@ int scols_column_is_tree(struct libscols_column *cl)
|
||||||
*/
|
*/
|
||||||
int scols_column_is_right(struct libscols_column *cl)
|
int scols_column_is_right(struct libscols_column *cl)
|
||||||
{
|
{
|
||||||
assert(cl);
|
|
||||||
if (!cl)
|
if (!cl)
|
||||||
return -EINVAL;
|
return -EINVAL;
|
||||||
return cl->flags & SCOLS_FL_RIGHT;
|
return cl->flags & SCOLS_FL_RIGHT;
|
||||||
|
@ -321,7 +310,6 @@ int scols_column_is_right(struct libscols_column *cl)
|
||||||
*/
|
*/
|
||||||
int scols_column_is_strict_width(struct libscols_column *cl)
|
int scols_column_is_strict_width(struct libscols_column *cl)
|
||||||
{
|
{
|
||||||
assert(cl);
|
|
||||||
if (!cl)
|
if (!cl)
|
||||||
return -EINVAL;
|
return -EINVAL;
|
||||||
return cl->flags & SCOLS_FL_STRICTWIDTH;
|
return cl->flags & SCOLS_FL_STRICTWIDTH;
|
||||||
|
@ -336,7 +324,6 @@ int scols_column_is_strict_width(struct libscols_column *cl)
|
||||||
*/
|
*/
|
||||||
int scols_column_is_noextremes(struct libscols_column *cl)
|
int scols_column_is_noextremes(struct libscols_column *cl)
|
||||||
{
|
{
|
||||||
assert(cl);
|
|
||||||
if (!cl)
|
if (!cl)
|
||||||
return -EINVAL;
|
return -EINVAL;
|
||||||
return cl->flags & SCOLS_FL_NOEXTREMES;
|
return cl->flags & SCOLS_FL_NOEXTREMES;
|
||||||
|
|
|
@ -122,8 +122,6 @@ int scols_line_alloc_cells(struct libscols_line *ln, size_t n)
|
||||||
{
|
{
|
||||||
struct libscols_cell *ce;
|
struct libscols_cell *ce;
|
||||||
|
|
||||||
assert(ln);
|
|
||||||
|
|
||||||
if (!ln)
|
if (!ln)
|
||||||
return -EINVAL;
|
return -EINVAL;
|
||||||
if (ln->ncells == n)
|
if (ln->ncells == n)
|
||||||
|
@ -160,7 +158,6 @@ int scols_line_alloc_cells(struct libscols_line *ln, size_t n)
|
||||||
*/
|
*/
|
||||||
int scols_line_set_userdata(struct libscols_line *ln, void *data)
|
int scols_line_set_userdata(struct libscols_line *ln, void *data)
|
||||||
{
|
{
|
||||||
assert(ln);
|
|
||||||
if (!ln)
|
if (!ln)
|
||||||
return -EINVAL;
|
return -EINVAL;
|
||||||
ln->userdata = data;
|
ln->userdata = data;
|
||||||
|
@ -190,9 +187,6 @@ void *scols_line_get_userdata(struct libscols_line *ln)
|
||||||
*/
|
*/
|
||||||
int scols_line_remove_child(struct libscols_line *ln, struct libscols_line *child)
|
int scols_line_remove_child(struct libscols_line *ln, struct libscols_line *child)
|
||||||
{
|
{
|
||||||
assert(ln);
|
|
||||||
assert(child);
|
|
||||||
|
|
||||||
if (!ln || !child)
|
if (!ln || !child)
|
||||||
return -EINVAL;
|
return -EINVAL;
|
||||||
|
|
||||||
|
@ -217,9 +211,6 @@ int scols_line_remove_child(struct libscols_line *ln, struct libscols_line *chil
|
||||||
*/
|
*/
|
||||||
int scols_line_add_child(struct libscols_line *ln, struct libscols_line *child)
|
int scols_line_add_child(struct libscols_line *ln, struct libscols_line *child)
|
||||||
{
|
{
|
||||||
assert(ln);
|
|
||||||
assert(child);
|
|
||||||
|
|
||||||
if (!ln || !child)
|
if (!ln || !child)
|
||||||
return -EINVAL;
|
return -EINVAL;
|
||||||
|
|
||||||
|
@ -248,7 +239,6 @@ int scols_line_add_child(struct libscols_line *ln, struct libscols_line *child)
|
||||||
*/
|
*/
|
||||||
struct libscols_line *scols_line_get_parent(struct libscols_line *ln)
|
struct libscols_line *scols_line_get_parent(struct libscols_line *ln)
|
||||||
{
|
{
|
||||||
assert(ln);
|
|
||||||
return ln ? ln->parent : NULL;
|
return ln ? ln->parent : NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -260,7 +250,6 @@ struct libscols_line *scols_line_get_parent(struct libscols_line *ln)
|
||||||
*/
|
*/
|
||||||
int scols_line_has_children(struct libscols_line *ln)
|
int scols_line_has_children(struct libscols_line *ln)
|
||||||
{
|
{
|
||||||
assert(ln);
|
|
||||||
return ln ? !list_empty(&ln->ln_branch) : 0;
|
return ln ? !list_empty(&ln->ln_branch) : 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -305,7 +294,6 @@ int scols_line_set_color(struct libscols_line *ln, const char *color)
|
||||||
{
|
{
|
||||||
char *p = NULL;
|
char *p = NULL;
|
||||||
|
|
||||||
assert(ln);
|
|
||||||
if (!ln)
|
if (!ln)
|
||||||
return -EINVAL;
|
return -EINVAL;
|
||||||
if (color) {
|
if (color) {
|
||||||
|
@ -333,7 +321,6 @@ int scols_line_set_color(struct libscols_line *ln, const char *color)
|
||||||
*/
|
*/
|
||||||
const char *scols_line_get_color(struct libscols_line *ln)
|
const char *scols_line_get_color(struct libscols_line *ln)
|
||||||
{
|
{
|
||||||
assert(ln);
|
|
||||||
return ln ? ln->color : NULL;
|
return ln ? ln->color : NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -345,7 +332,6 @@ const char *scols_line_get_color(struct libscols_line *ln)
|
||||||
*/
|
*/
|
||||||
size_t scols_line_get_ncells(struct libscols_line *ln)
|
size_t scols_line_get_ncells(struct libscols_line *ln)
|
||||||
{
|
{
|
||||||
assert(ln);
|
|
||||||
return ln ? ln->ncells : 0;
|
return ln ? ln->ncells : 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -359,8 +345,6 @@ size_t scols_line_get_ncells(struct libscols_line *ln)
|
||||||
struct libscols_cell *scols_line_get_cell(struct libscols_line *ln,
|
struct libscols_cell *scols_line_get_cell(struct libscols_line *ln,
|
||||||
size_t n)
|
size_t n)
|
||||||
{
|
{
|
||||||
assert(ln);
|
|
||||||
|
|
||||||
if (!ln || n >= ln->ncells)
|
if (!ln || n >= ln->ncells)
|
||||||
return NULL;
|
return NULL;
|
||||||
return &ln->cells[n];
|
return &ln->cells[n];
|
||||||
|
@ -379,8 +363,8 @@ struct libscols_cell *scols_line_get_column_cell(
|
||||||
struct libscols_line *ln,
|
struct libscols_line *ln,
|
||||||
struct libscols_column *cl)
|
struct libscols_column *cl)
|
||||||
{
|
{
|
||||||
assert(ln);
|
if (!ln || !cl)
|
||||||
assert(cl);
|
return NULL;
|
||||||
|
|
||||||
return scols_line_get_cell(ln, cl->seqnum);
|
return scols_line_get_cell(ln, cl->seqnum);
|
||||||
}
|
}
|
||||||
|
@ -430,7 +414,6 @@ struct libscols_line *scols_copy_line(struct libscols_line *ln)
|
||||||
struct libscols_line *ret;
|
struct libscols_line *ret;
|
||||||
size_t i;
|
size_t i;
|
||||||
|
|
||||||
assert (ln);
|
|
||||||
if (!ln)
|
if (!ln)
|
||||||
return NULL;
|
return NULL;
|
||||||
|
|
||||||
|
|
|
@ -104,9 +104,6 @@ void scols_unref_table(struct libscols_table *tb)
|
||||||
*/
|
*/
|
||||||
int scols_table_add_column(struct libscols_table *tb, struct libscols_column *cl)
|
int scols_table_add_column(struct libscols_table *tb, struct libscols_column *cl)
|
||||||
{
|
{
|
||||||
assert(tb);
|
|
||||||
assert(cl);
|
|
||||||
|
|
||||||
if (!tb || !cl || !list_empty(&tb->tb_lines))
|
if (!tb || !cl || !list_empty(&tb->tb_lines))
|
||||||
return -EINVAL;
|
return -EINVAL;
|
||||||
|
|
||||||
|
@ -139,9 +136,6 @@ int scols_table_add_column(struct libscols_table *tb, struct libscols_column *cl
|
||||||
int scols_table_remove_column(struct libscols_table *tb,
|
int scols_table_remove_column(struct libscols_table *tb,
|
||||||
struct libscols_column *cl)
|
struct libscols_column *cl)
|
||||||
{
|
{
|
||||||
assert(tb);
|
|
||||||
assert(cl);
|
|
||||||
|
|
||||||
if (!tb || !cl || !list_empty(&tb->tb_lines))
|
if (!tb || !cl || !list_empty(&tb->tb_lines))
|
||||||
return -EINVAL;
|
return -EINVAL;
|
||||||
|
|
||||||
|
@ -165,8 +159,6 @@ int scols_table_remove_column(struct libscols_table *tb,
|
||||||
*/
|
*/
|
||||||
int scols_table_remove_columns(struct libscols_table *tb)
|
int scols_table_remove_columns(struct libscols_table *tb)
|
||||||
{
|
{
|
||||||
assert(tb);
|
|
||||||
|
|
||||||
if (!tb || !list_empty(&tb->tb_lines))
|
if (!tb || !list_empty(&tb->tb_lines))
|
||||||
return -EINVAL;
|
return -EINVAL;
|
||||||
|
|
||||||
|
@ -222,7 +214,6 @@ struct libscols_column *scols_table_new_column(struct libscols_table *tb,
|
||||||
struct libscols_column *cl;
|
struct libscols_column *cl;
|
||||||
struct libscols_cell *hr;
|
struct libscols_cell *hr;
|
||||||
|
|
||||||
assert (tb);
|
|
||||||
if (!tb)
|
if (!tb)
|
||||||
return NULL;
|
return NULL;
|
||||||
|
|
||||||
|
@ -291,7 +282,6 @@ int scols_table_next_column(struct libscols_table *tb,
|
||||||
*/
|
*/
|
||||||
int scols_table_get_ncols(struct libscols_table *tb)
|
int scols_table_get_ncols(struct libscols_table *tb)
|
||||||
{
|
{
|
||||||
assert(tb);
|
|
||||||
return tb ? tb->ncols : -EINVAL;
|
return tb ? tb->ncols : -EINVAL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -303,7 +293,6 @@ int scols_table_get_ncols(struct libscols_table *tb)
|
||||||
*/
|
*/
|
||||||
int scols_table_get_nlines(struct libscols_table *tb)
|
int scols_table_get_nlines(struct libscols_table *tb)
|
||||||
{
|
{
|
||||||
assert(tb);
|
|
||||||
return tb ? tb->nlines : -EINVAL;
|
return tb ? tb->nlines : -EINVAL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -337,7 +326,6 @@ int scols_table_set_stream(struct libscols_table *tb, FILE *stream)
|
||||||
*/
|
*/
|
||||||
FILE *scols_table_get_stream(struct libscols_table *tb)
|
FILE *scols_table_get_stream(struct libscols_table *tb)
|
||||||
{
|
{
|
||||||
assert(tb);
|
|
||||||
return tb ? tb->out: NULL;
|
return tb ? tb->out: NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -352,7 +340,6 @@ FILE *scols_table_get_stream(struct libscols_table *tb)
|
||||||
*/
|
*/
|
||||||
int scols_table_reduce_termwidth(struct libscols_table *tb, size_t reduce)
|
int scols_table_reduce_termwidth(struct libscols_table *tb, size_t reduce)
|
||||||
{
|
{
|
||||||
assert(tb);
|
|
||||||
if (!tb)
|
if (!tb)
|
||||||
return -EINVAL;
|
return -EINVAL;
|
||||||
|
|
||||||
|
@ -374,7 +361,6 @@ struct libscols_column *scols_table_get_column(struct libscols_table *tb,
|
||||||
struct libscols_iter itr;
|
struct libscols_iter itr;
|
||||||
struct libscols_column *cl;
|
struct libscols_column *cl;
|
||||||
|
|
||||||
assert(tb);
|
|
||||||
if (!tb)
|
if (!tb)
|
||||||
return NULL;
|
return NULL;
|
||||||
if (n >= tb->ncols)
|
if (n >= tb->ncols)
|
||||||
|
@ -400,10 +386,6 @@ struct libscols_column *scols_table_get_column(struct libscols_table *tb,
|
||||||
*/
|
*/
|
||||||
int scols_table_add_line(struct libscols_table *tb, struct libscols_line *ln)
|
int scols_table_add_line(struct libscols_table *tb, struct libscols_line *ln)
|
||||||
{
|
{
|
||||||
|
|
||||||
assert(tb);
|
|
||||||
assert(ln);
|
|
||||||
|
|
||||||
if (!tb || !ln)
|
if (!tb || !ln)
|
||||||
return -EINVAL;
|
return -EINVAL;
|
||||||
|
|
||||||
|
@ -433,9 +415,6 @@ int scols_table_add_line(struct libscols_table *tb, struct libscols_line *ln)
|
||||||
int scols_table_remove_line(struct libscols_table *tb,
|
int scols_table_remove_line(struct libscols_table *tb,
|
||||||
struct libscols_line *ln)
|
struct libscols_line *ln)
|
||||||
{
|
{
|
||||||
assert(tb);
|
|
||||||
assert(ln);
|
|
||||||
|
|
||||||
if (!tb || !ln)
|
if (!tb || !ln)
|
||||||
return -EINVAL;
|
return -EINVAL;
|
||||||
|
|
||||||
|
@ -517,9 +496,6 @@ struct libscols_line *scols_table_new_line(struct libscols_table *tb,
|
||||||
{
|
{
|
||||||
struct libscols_line *ln;
|
struct libscols_line *ln;
|
||||||
|
|
||||||
assert(tb);
|
|
||||||
assert(tb->ncols);
|
|
||||||
|
|
||||||
if (!tb || !tb->ncols)
|
if (!tb || !tb->ncols)
|
||||||
return NULL;
|
return NULL;
|
||||||
|
|
||||||
|
@ -558,7 +534,6 @@ struct libscols_line *scols_table_get_line(struct libscols_table *tb,
|
||||||
struct libscols_iter itr;
|
struct libscols_iter itr;
|
||||||
struct libscols_line *ln;
|
struct libscols_line *ln;
|
||||||
|
|
||||||
assert(tb);
|
|
||||||
if (!tb)
|
if (!tb)
|
||||||
return NULL;
|
return NULL;
|
||||||
if (n >= tb->nlines)
|
if (n >= tb->nlines)
|
||||||
|
@ -588,7 +563,6 @@ struct libscols_table *scols_copy_table(struct libscols_table *tb)
|
||||||
struct libscols_column *cl;
|
struct libscols_column *cl;
|
||||||
struct libscols_iter itr;
|
struct libscols_iter itr;
|
||||||
|
|
||||||
assert(tb);
|
|
||||||
if (!tb)
|
if (!tb)
|
||||||
return NULL;
|
return NULL;
|
||||||
ret = scols_new_table();
|
ret = scols_new_table();
|
||||||
|
@ -654,8 +628,6 @@ err:
|
||||||
int scols_table_set_symbols(struct libscols_table *tb,
|
int scols_table_set_symbols(struct libscols_table *tb,
|
||||||
struct libscols_symbols *sy)
|
struct libscols_symbols *sy)
|
||||||
{
|
{
|
||||||
assert(tb);
|
|
||||||
|
|
||||||
if (!tb)
|
if (!tb)
|
||||||
return -EINVAL;
|
return -EINVAL;
|
||||||
|
|
||||||
|
@ -698,7 +670,6 @@ int scols_table_set_symbols(struct libscols_table *tb,
|
||||||
*/
|
*/
|
||||||
int scols_table_enable_colors(struct libscols_table *tb, int enable)
|
int scols_table_enable_colors(struct libscols_table *tb, int enable)
|
||||||
{
|
{
|
||||||
assert(tb);
|
|
||||||
if (!tb)
|
if (!tb)
|
||||||
return -EINVAL;
|
return -EINVAL;
|
||||||
|
|
||||||
|
@ -718,7 +689,6 @@ int scols_table_enable_colors(struct libscols_table *tb, int enable)
|
||||||
*/
|
*/
|
||||||
int scols_table_enable_raw(struct libscols_table *tb, int enable)
|
int scols_table_enable_raw(struct libscols_table *tb, int enable)
|
||||||
{
|
{
|
||||||
assert(tb);
|
|
||||||
if (!tb)
|
if (!tb)
|
||||||
return -EINVAL;
|
return -EINVAL;
|
||||||
|
|
||||||
|
@ -742,7 +712,6 @@ int scols_table_enable_raw(struct libscols_table *tb, int enable)
|
||||||
*/
|
*/
|
||||||
int scols_table_enable_export(struct libscols_table *tb, int enable)
|
int scols_table_enable_export(struct libscols_table *tb, int enable)
|
||||||
{
|
{
|
||||||
assert(tb);
|
|
||||||
if (!tb)
|
if (!tb)
|
||||||
return -EINVAL;
|
return -EINVAL;
|
||||||
|
|
||||||
|
@ -771,7 +740,6 @@ int scols_table_enable_export(struct libscols_table *tb, int enable)
|
||||||
*/
|
*/
|
||||||
int scols_table_enable_ascii(struct libscols_table *tb, int enable)
|
int scols_table_enable_ascii(struct libscols_table *tb, int enable)
|
||||||
{
|
{
|
||||||
assert(tb);
|
|
||||||
if (!tb)
|
if (!tb)
|
||||||
return -EINVAL;
|
return -EINVAL;
|
||||||
|
|
||||||
|
@ -791,7 +759,6 @@ int scols_table_enable_ascii(struct libscols_table *tb, int enable)
|
||||||
*/
|
*/
|
||||||
int scols_table_enable_noheadings(struct libscols_table *tb, int enable)
|
int scols_table_enable_noheadings(struct libscols_table *tb, int enable)
|
||||||
{
|
{
|
||||||
assert(tb);
|
|
||||||
if (!tb)
|
if (!tb)
|
||||||
return -EINVAL;
|
return -EINVAL;
|
||||||
DBG(TAB, ul_debugobj(tb, "noheading: %s", enable ? "ENABLE" : "DISABLE"));
|
DBG(TAB, ul_debugobj(tb, "noheading: %s", enable ? "ENABLE" : "DISABLE"));
|
||||||
|
@ -811,7 +778,6 @@ int scols_table_enable_noheadings(struct libscols_table *tb, int enable)
|
||||||
*/
|
*/
|
||||||
int scols_table_enable_maxout(struct libscols_table *tb, int enable)
|
int scols_table_enable_maxout(struct libscols_table *tb, int enable)
|
||||||
{
|
{
|
||||||
assert(tb);
|
|
||||||
if (!tb)
|
if (!tb)
|
||||||
return -EINVAL;
|
return -EINVAL;
|
||||||
DBG(TAB, ul_debugobj(tb, "maxout: %s", enable ? "ENABLE" : "DISABLE"));
|
DBG(TAB, ul_debugobj(tb, "maxout: %s", enable ? "ENABLE" : "DISABLE"));
|
||||||
|
@ -827,7 +793,6 @@ int scols_table_enable_maxout(struct libscols_table *tb, int enable)
|
||||||
*/
|
*/
|
||||||
int scols_table_colors_wanted(struct libscols_table *tb)
|
int scols_table_colors_wanted(struct libscols_table *tb)
|
||||||
{
|
{
|
||||||
assert(tb);
|
|
||||||
return tb && tb->colors_wanted;
|
return tb && tb->colors_wanted;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -839,7 +804,6 @@ int scols_table_colors_wanted(struct libscols_table *tb)
|
||||||
*/
|
*/
|
||||||
int scols_table_is_empty(struct libscols_table *tb)
|
int scols_table_is_empty(struct libscols_table *tb)
|
||||||
{
|
{
|
||||||
assert(tb);
|
|
||||||
return !tb || !tb->nlines;
|
return !tb || !tb->nlines;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -851,7 +815,6 @@ int scols_table_is_empty(struct libscols_table *tb)
|
||||||
*/
|
*/
|
||||||
int scols_table_is_ascii(struct libscols_table *tb)
|
int scols_table_is_ascii(struct libscols_table *tb)
|
||||||
{
|
{
|
||||||
assert(tb);
|
|
||||||
return tb && tb->ascii;
|
return tb && tb->ascii;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -863,7 +826,6 @@ int scols_table_is_ascii(struct libscols_table *tb)
|
||||||
*/
|
*/
|
||||||
int scols_table_is_noheadings(struct libscols_table *tb)
|
int scols_table_is_noheadings(struct libscols_table *tb)
|
||||||
{
|
{
|
||||||
assert(tb);
|
|
||||||
return tb && tb->no_headings;
|
return tb && tb->no_headings;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -875,7 +837,6 @@ int scols_table_is_noheadings(struct libscols_table *tb)
|
||||||
*/
|
*/
|
||||||
int scols_table_is_export(struct libscols_table *tb)
|
int scols_table_is_export(struct libscols_table *tb)
|
||||||
{
|
{
|
||||||
assert(tb);
|
|
||||||
return tb && tb->format == SCOLS_FMT_EXPORT;
|
return tb && tb->format == SCOLS_FMT_EXPORT;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -887,7 +848,6 @@ int scols_table_is_export(struct libscols_table *tb)
|
||||||
*/
|
*/
|
||||||
int scols_table_is_raw(struct libscols_table *tb)
|
int scols_table_is_raw(struct libscols_table *tb)
|
||||||
{
|
{
|
||||||
assert(tb);
|
|
||||||
return tb && tb->format == SCOLS_FMT_RAW;
|
return tb && tb->format == SCOLS_FMT_RAW;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -900,7 +860,6 @@ int scols_table_is_raw(struct libscols_table *tb)
|
||||||
*/
|
*/
|
||||||
int scols_table_is_maxout(struct libscols_table *tb)
|
int scols_table_is_maxout(struct libscols_table *tb)
|
||||||
{
|
{
|
||||||
assert(tb);
|
|
||||||
return tb && tb->maxout;
|
return tb && tb->maxout;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -912,7 +871,6 @@ int scols_table_is_maxout(struct libscols_table *tb)
|
||||||
*/
|
*/
|
||||||
int scols_table_is_tree(struct libscols_table *tb)
|
int scols_table_is_tree(struct libscols_table *tb)
|
||||||
{
|
{
|
||||||
assert(tb);
|
|
||||||
return tb && tb->ntreecols > 0;
|
return tb && tb->ntreecols > 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -930,11 +888,8 @@ int scols_table_set_column_separator(struct libscols_table *tb, const char *sep)
|
||||||
{
|
{
|
||||||
char *p = NULL;
|
char *p = NULL;
|
||||||
|
|
||||||
assert (tb);
|
|
||||||
|
|
||||||
if (!tb)
|
if (!tb)
|
||||||
return -EINVAL;
|
return -EINVAL;
|
||||||
|
|
||||||
if (sep) {
|
if (sep) {
|
||||||
p = strdup(sep);
|
p = strdup(sep);
|
||||||
if (!p)
|
if (!p)
|
||||||
|
@ -960,8 +915,6 @@ int scols_table_set_line_separator(struct libscols_table *tb, const char *sep)
|
||||||
{
|
{
|
||||||
char *p = NULL;
|
char *p = NULL;
|
||||||
|
|
||||||
assert (tb);
|
|
||||||
|
|
||||||
if (!tb)
|
if (!tb)
|
||||||
return -EINVAL;
|
return -EINVAL;
|
||||||
|
|
||||||
|
@ -985,8 +938,6 @@ int scols_table_set_line_separator(struct libscols_table *tb, const char *sep)
|
||||||
*/
|
*/
|
||||||
char *scols_table_get_column_separator(struct libscols_table *tb)
|
char *scols_table_get_column_separator(struct libscols_table *tb)
|
||||||
{
|
{
|
||||||
assert (tb);
|
|
||||||
|
|
||||||
if (!tb)
|
if (!tb)
|
||||||
return NULL;
|
return NULL;
|
||||||
return tb->colsep;
|
return tb->colsep;
|
||||||
|
@ -1000,8 +951,6 @@ char *scols_table_get_column_separator(struct libscols_table *tb)
|
||||||
*/
|
*/
|
||||||
char *scols_table_get_line_separator(struct libscols_table *tb)
|
char *scols_table_get_line_separator(struct libscols_table *tb)
|
||||||
{
|
{
|
||||||
assert (tb);
|
|
||||||
|
|
||||||
if (!tb)
|
if (!tb)
|
||||||
return NULL;
|
return NULL;
|
||||||
return tb->linesep;
|
return tb->linesep;
|
||||||
|
@ -1037,9 +986,6 @@ static int cells_cmp_wrapper(struct list_head *a, struct list_head *b, void *dat
|
||||||
*/
|
*/
|
||||||
int scols_sort_table(struct libscols_table *tb, struct libscols_column *cl)
|
int scols_sort_table(struct libscols_table *tb, struct libscols_column *cl)
|
||||||
{
|
{
|
||||||
assert(tb);
|
|
||||||
assert(cl);
|
|
||||||
|
|
||||||
if (!tb || !cl)
|
if (!tb || !cl)
|
||||||
return -EINVAL;
|
return -EINVAL;
|
||||||
|
|
||||||
|
|
|
@ -820,9 +820,8 @@ int scols_print_table(struct libscols_table *tb)
|
||||||
struct libscols_iter itr;
|
struct libscols_iter itr;
|
||||||
struct libscols_buffer *buf;
|
struct libscols_buffer *buf;
|
||||||
|
|
||||||
assert(tb);
|
|
||||||
if (!tb)
|
if (!tb)
|
||||||
return -1;
|
return -EINVAL;
|
||||||
|
|
||||||
DBG(TAB, ul_debugobj(tb, "printing"));
|
DBG(TAB, ul_debugobj(tb, "printing"));
|
||||||
if (!tb->symbols)
|
if (!tb->symbols)
|
||||||
|
|
Loading…
Reference in New Issue