parse/bitset.c
/* Duplicates a bitset. NULL is duplicated to NULL. */
Duplicates a bitset. NULL is duplicated to NULL.
Duplicates a bitset . NULL is duplicated to NULL .
Bitset *bsdup(Bitset *a)
{
    Bitset *bs;
    if (!a)
        return NULL;
    bs = xalloc(sizeof(Bitset));
    bs->nchunks = a->nchunks;
    bs->chunks = xalloc(a->nchunks*sizeof(size_t));
    memcpy(bs->chunks, a->chunks, a->nchunks*sizeof(size_t));
    return bs;
}
Bitset * bsdup ( Bitset * a ) { Bitset * bs ; if ( ! a ) return NULL ; bs = xalloc ( sizeof ( Bitset ) ) ; bs -> nchunks = a -> nchunks ; bs -> chunks = xalloc ( a -> nchunks * sizeof ( size_t ) ) ; memcpy ( bs -> chunks , a -> chunks , a -> nchunks * sizeof ( size_t ) ) ; return bs ; }
Duplicates a bitset.
Duplicates a bitset .