Exemple #1
0
ds_safeq_t *
ds_safeq_create() 
{
    ds_safeq_t *result;

    ALLOC(result,ds_safeq_t);
    result->sq_magic = ds_safeq_magic;
    Lock_Init(&result->sq_lock);
    result->sq_list = ds_list_create(NULL, FALSE, TRUE);
    CODA_ASSERT(result->sq_list);
    
    return result;
}
Exemple #2
0
ds_hash_t *ds_hash_create(COMPFN c, HFN h, int nbuckets, bool safe_destroy,
                          bool dups_ok)
{
    ds_hash_t *result;
    int i;

    CODA_ASSERT(h != NULL);
    CODA_ASSERT(nbuckets > 0);

    ALLOC(result, ds_hash_t);

    result->magic    = ds_hash_magic;
    result->hfn      = h;
    result->count    = 0;
    result->nbuckets = nbuckets;

    NALLOC(result->buckets, ds_list_t *, nbuckets);
    for (i = 0; i < nbuckets; i++) {
        (result->buckets)[i] = ds_list_create(c, safe_destroy, dups_ok);
    }

    return result;
}