All pastes #396745 Raw Edit

Unnamed

public text v1 · immutable
·published 2007-03-15 23:55 UTC
rendered paste body
void put_hashset (hashset_ref hash, hashset_key_t key) {
   cstring duped;
   hashcode_t hashnum = strhash(key) % hash->header_dim;
   if (has_hashset(hash, key) == FALSE){
      hashnode_ref newnode = malloc (sizeof (struct hashnode));
      assert (newnode);
      duped = strdup(key);
      assert (duped); 
      newnode->key = duped;
      newnode->link = hash->headers[hashnum];
      hash->headers[hashnum] = newnode;
      hash->load_count++;
   }
}