Exemple #1
0
Hash resize_Hash(Hash H, unsigned int newLength){
	List l;
	List_Iter it;
	unsigned int i;
	Hash newHash;

	assert(newLength);

	newHash = new_Hash(newLength);

	for (i = 0; i < H->length; ++i){
		l = H->lists[i];
		it = begin_List(l);
		while (it != end_List(l)){
			add_Hash(newHash, getElem_List(l, it));

			it = next_List(l, it);
		}
	}

	delete_Hash(H);

	return newHash;
}
Exemple #2
0
int add_OnlineUser(User *u) {
	if (u == NULL || !u->name[0])
		return -1;

	return add_Hash(online_users, u->name, u, NULL);
}