assoc.c
/* Note: this isn't an assoc_update.  The key must not already exist to call this */
this isn't an assoc_update.  The key must not already exist to call this
this isn ' t an assoc_update . The key must not already exist to call this
int assoc_insert(item *it, const uint32_t hv) {
    unsigned int oldbucket;
    if (expanding &&
        (oldbucket = (hv & hashmask(hashpower - 1))) >= expand_bucket)
    {
        it->h_next = old_hashtable[oldbucket];
        old_hashtable[oldbucket] = it;
    } else {
        it->h_next = primary_hashtable[hv & hashmask(hashpower)];
        primary_hashtable[hv & hashmask(hashpower)] = it;
    }
    hash_items++;
    if (! expanding && hash_items > (hashsize(hashpower) * 3) / 2) {
        assoc_expand();
    }
    MEMCACHED_ASSOC_INSERT(ITEM_key(it), it->nkey, hash_items);
    return 1;
}
int assoc_insert ( item * it , const uint32_t hv ) { unsigned int oldbucket ; if ( expanding && ( oldbucket = ( hv & hashmask ( hashpower - 1 ) ) ) >= expand_bucket ) { it -> h_next = old_hashtable [ oldbucket ] ; old_hashtable [ oldbucket ] = it ; } else { it -> h_next = primary_hashtable [ hv & hashmask ( hashpower ) ] ; primary_hashtable [ hv & hashmask ( hashpower ) ] = it ; } hash_items ++ ; if ( ! expanding && hash_items > ( hashsize ( hashpower ) * 3 ) / 2 ) { assoc_expand ( ) ; } MEMCACHED_ASSOC_INSERT ( ITEM_key ( it ) , it -> nkey , hash_items ) ; return 1 ; }
Note: this isn't an assoc_update.
Note : this isn ' t an assoc_update .
//    assert(assoc_find(ITEM_key(it), it->nkey) == 0);  /* shouldn't have duplicately named things defined */