Ejemplo n.º 1
0
void
bighash_insert(bighash_table_t *table, bighash_entry_t *e, uint32_t hash)
{
    bighash_entry_t **bucket = bighash_bucket(table, hash);
    e->next = *bucket;
    e->hash = hash;
    *bucket = e;
    table->entry_count++;
}
Ejemplo n.º 2
0
bighash_entry_t *
bighash_first(bighash_table_t *table, uint32_t hash)
{
    bighash_entry_t *e = *bighash_bucket(table, hash);
    while (e != NULL) {
        if (e->hash == hash) {
            return e;
        }
        e = e->next;
    }
    return NULL;
}
Ejemplo n.º 3
0
void
bighash_remove(bighash_table_t *table, bighash_entry_t *e)
{
    bighash_entry_t **prev_ptr = bighash_bucket(table, e->hash);
    bighash_entry_t *cur = *prev_ptr;
    while (cur != NULL) {
        if (cur == e) {
            *prev_ptr = cur->next;
            table->entry_count--;
            return;
        }
        prev_ptr = &cur->next;
        cur = *prev_ptr;
    }
}
Ejemplo n.º 4
0
void
bighash_insert(bighash_table_t *table, bighash_entry_t *e, uint32_t hash)
{
    bighash_entry_t **bucket = bighash_bucket(table, hash);
    e->next = *bucket;
    e->hash = hash;
    *bucket = e;
    table->entry_count++;

    if (table->flags & BIGHASH_TABLE_F_AUTOGROW) {
        if (table->entry_count >= table->bucket_count*BIGHASH_CONFIG_LOAD_FACTOR) {
            bighash_grow(table);
        }
    }
}