openbmc/build/tmp/deploy/sdk/witherspoon-2019-08-08/sysroots/armv6-openbmc-linux-gnueabi/usr/src/debug/util-linux/2.33.2-r0/util-linux-2.33.2/libsmartcols/src/table.c
int scols_table_add_column(struct libscols_table* tb,
                           struct libscols_column* cl)
{
    struct libscols_iter itr;
    struct libscols_line* ln;
    int rc = 0;

    if (!tb || !cl || cl->table)
        return -EINVAL;

    if (cl->flags & SCOLS_FL_TREE)
        tb->ntreecols++;

    DBG(TAB, ul_debugobj(tb, "add column"));
    list_add_tail(&cl->cl_columns, &tb->tb_columns);
    cl->seqnum = tb->ncols++;
    cl->table = tb;
    scols_ref_column(cl);

    if (list_empty(&tb->tb_lines))
        return 0;

    scols_reset_iter(&itr, SCOLS_ITER_FORWARD);

    /* Realloc line cell arrays
     */
    while (scols_table_next_line(tb, &itr, &ln) == 0)
    {
        rc = scols_line_alloc_cells(ln, tb->ncols);
        if (rc)
            break;
    }

    return rc;
}
/**
 * scols_table_add_column:
 * @tb: a pointer to a struct libscols_table instance
 * @cl: a pointer to a struct libscols_column instance
 *
 * Adds @cl to @tb's column list. The column cannot be shared between more
 * tables.
 *
 * Returns: 0, a negative number in case of an error.
 */
@tb: a pointer to a struct libscols_table instance
@cl: a pointer to a struct libscols_column instance

Adds @cl to @tb's column list. The column cannot be shared between more
tables.

0, a negative number in case of an error.
@tb : a pointer to a struct libscols_table instance @cl : a pointer to a struct libscols_column instance Adds @cl to @tb ' s column list . The column cannot be shared between more tables . 0 a negative number in case of an error .
int scols_table_add_column(struct libscols_table* tb,
                           struct libscols_column* cl)
{
    struct libscols_iter itr;
    struct libscols_line* ln;
    int rc = 0;
    if (!tb || !cl || cl->table)
        return -EINVAL;
    if (cl->flags & SCOLS_FL_TREE)
        tb->ntreecols++;
    DBG(TAB, ul_debugobj(tb, "add column"));
    list_add_tail(&cl->cl_columns, &tb->tb_columns);
    cl->seqnum = tb->ncols++;
    cl->table = tb;
    scols_ref_column(cl);
    if (list_empty(&tb->tb_lines))
        return 0;
    scols_reset_iter(&itr, SCOLS_ITER_FORWARD);
    while (scols_table_next_line(tb, &itr, &ln) == 0)
    {
        rc = scols_line_alloc_cells(ln, tb->ncols);
        if (rc)
            break;
    }
    return rc;
}
int scols_table_add_column ( struct libscols_table * tb , struct libscols_column * cl ) { struct libscols_iter itr ; struct libscols_line * ln ; int rc = 0 ; if ( ! tb || ! cl || cl -> table ) return - EINVAL ; if ( cl -> flags & SCOLS_FL_TREE ) tb -> ntreecols ++ ; DBG ( TAB , ul_debugobj ( tb , " " ) ) ; list_add_tail ( & cl -> cl_columns , & tb -> tb_columns ) ; cl -> seqnum = tb -> ncols ++ ; cl -> table = tb ; scols_ref_column ( cl ) ; if ( list_empty ( & tb -> tb_lines ) ) return 0 ; scols_reset_iter ( & itr , SCOLS_ITER_FORWARD ) ; while ( scols_table_next_line ( tb , & itr , & ln ) == 0 ) { rc = scols_line_alloc_cells ( ln , tb -> ncols ) ; if ( rc ) break ; } return rc ; }
scols_table_add_column:
 @tb: a pointer to a struct libscols_table instance
 @cl: a pointer to a struct libscols_column instance
scols_table_add_column : @tb : a pointer to a struct libscols_table instance @cl : a pointer to a struct libscols_column instance
/* Realloc line cell arrays
     */