src/libmetha/utable.c
M_CODE
lm_utable_inc(utable_t *tb)
{
    int x;
    if (tb->sz >= tb->cap) {
        /* need realloc */
        tb->cap *= 2;
        if (!(tb->row = realloc(tb->row, tb->cap*sizeof(ulist_t))))
            return M_OUT_OF_MEM;
        for (x=tb->sz; x<tb->cap; x++)
            lm_ulist_init(&tb->row[x], ULIST_DEFAULT_PREALLOC);
    } else
        tb->row[tb->sz].private = 0;

    tb->sz++;
    return M_OK;
}
/** 
 * Increase the size of the table
 **/
Increase the size of the table
Increase the size of the table
M_CODE
lm_utable_inc(utable_t *tb)
{
    int x;
    if (tb->sz >= tb->cap) {
        tb->cap *= 2;
        if (!(tb->row = realloc(tb->row, tb->cap*sizeof(ulist_t))))
            return M_OUT_OF_MEM;
        for (x=tb->sz; x<tb->cap; x++)
            lm_ulist_init(&tb->row[x], ULIST_DEFAULT_PREALLOC);
    } else
        tb->row[tb->sz].private = 0;
    tb->sz++;
    return M_OK;
}
M_CODE lm_utable_inc ( utable_t * tb ) { int x ; if ( tb -> sz >= tb -> cap ) { tb -> cap *= 2 ; if ( ! ( tb -> row = realloc ( tb -> row , tb -> cap * sizeof ( ulist_t ) ) ) ) return M_OUT_OF_MEM ; for ( x = tb -> sz ; x < tb -> cap ; x ++ ) lm_ulist_init ( & tb -> row [ x ] , ULIST_DEFAULT_PREALLOC ) ; } else tb -> row [ tb -> sz ] . private = 0 ; tb -> sz ++ ; return M_OK ; }
Increase the size of the table
Increase the size of the table
/* need realloc */