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/line.c
int scols_line_alloc_cells(struct libscols_line* ln, size_t n)
{
    struct libscols_cell* ce;

    if (!ln)
        return -EINVAL;
    if (ln->ncells == n)
        return 0;

    if (!n)
    {
        scols_line_free_cells(ln);
        return 0;
    }

    DBG(LINE, ul_debugobj(ln, "alloc %zu cells", n));

    ce = realloc(ln->cells, n * sizeof(struct libscols_cell));
    if (!ce)
        return -errno;

    if (n > ln->ncells)
        memset(ce + ln->ncells, 0,
               (n - ln->ncells) * sizeof(struct libscols_cell));

    ln->cells = ce;
    ln->ncells = n;
    return 0;
}
/**
 * scols_line_alloc_cells:
 * @ln: a pointer to a struct libscols_line instance
 * @n: the number of elements
 *
 * Allocates space for @n cells. This function is optional,
 * and libsmartcols automatically allocates necessary cells
 * according to number of columns in the table when you add
 * the line to the table. See scols_table_add_line().
 *
 * Returns: 0, a negative value in case of an error.
 */
@ln: a pointer to a struct libscols_line instance
@n: the number of elements

Allocates space for @n cells. This function is optional,
and libsmartcols automatically allocates necessary cells
according to number of columns in the table when you add
the line to the table.

0, a negative value in case of an error.
@ln : a pointer to a struct libscols_line instance @n : the number of elements Allocates space for @n cells . This function is optional and libsmartcols automatically allocates necessary cells according to number of columns in the table when you add the line to the table . 0 a negative value in case of an error .
int scols_line_alloc_cells(struct libscols_line* ln, size_t n)
{
    struct libscols_cell* ce;
    if (!ln)
        return -EINVAL;
    if (ln->ncells == n)
        return 0;
    if (!n)
    {
        scols_line_free_cells(ln);
        return 0;
    }
    DBG(LINE, ul_debugobj(ln, "alloc %zu cells", n));
    ce = realloc(ln->cells, n * sizeof(struct libscols_cell));
    if (!ce)
        return -errno;
    if (n > ln->ncells)
        memset(ce + ln->ncells, 0,
               (n - ln->ncells) * sizeof(struct libscols_cell));
    ln->cells = ce;
    ln->ncells = n;
    return 0;
}
int scols_line_alloc_cells ( struct libscols_line * ln , size_t n ) { struct libscols_cell * ce ; if ( ! ln ) return - EINVAL ; if ( ln -> ncells == n ) return 0 ; if ( ! n ) { scols_line_free_cells ( ln ) ; return 0 ; } DBG ( LINE , ul_debugobj ( ln , " " , n ) ) ; ce = realloc ( ln -> cells , n * sizeof ( struct libscols_cell ) ) ; if ( ! ce ) return - errno ; if ( n > ln -> ncells ) memset ( ce + ln -> ncells , 0 , ( n - ln -> ncells ) * sizeof ( struct libscols_cell ) ) ; ln -> cells = ce ; ln -> ncells = n ; return 0 ; }
scols_line_alloc_cells:
 @ln: a pointer to a struct libscols_line instance
 @n: the number of elements
scols_line_alloc_cells : @ln : a pointer to a struct libscols_line instance @n : the number of elements