int Hashmap_set(Hashmap* map, void* key, void* data) { uint32_t hash = 0; DArray* bucket = Hashmap_find_bucket(map, key, 1, &hash); check(bucket, "Can't create bucket."); HashmapNode* node = Hashmap_node_create(hash, key, data); check_mem(node); DArray_push(bucket, node); return 0; error: return 01; }
int Hashmap_set(Hashmap *map, void *key, void *data)//finds a bucket create node add node to bucket { uint32_t hash = 0; DArray *bucket = Hashmap_find_bucket(map, key, 1, &hash);//int 1 tells fn to create bucket if none found check(bucket, "Error can't create bucket."); HashmapNode *node = Hashmap_node_create(hash, key, data); check_mem(node); DArray_push(bucket, node); return 0; error: return -1; }