1
0
forked from bip/bip

Use hash_it_key cause now hash items can be null.

This commit is contained in:
Arnaud Cornet 2008-12-20 21:15:04 +01:00
parent fa78df6482
commit 7c6cc20e90
2 changed files with 3 additions and 2 deletions

View File

@ -113,7 +113,7 @@ list_t *channel_name_list(struct channel *c)
ret = list_new(NULL); ret = list_new(NULL);
*str = 0; *str = 0;
for (hash_it_init(&c->ovmasks, &hi); hash_it_item(&hi); for (hash_it_init(&c->ovmasks, &hi); hash_it_key(&hi);
hash_it_next(&hi)){ hash_it_next(&hi)){
const char *nick = hash_it_key(&hi); const char *nick = hash_it_key(&hi);
long int ovmask = (long int)hash_it_item(&hi); long int ovmask = (long int)hash_it_item(&hi);
@ -1385,6 +1385,7 @@ static int irc_353(struct link_server *server, struct line *line)
/* we just ignore names for nicks that are crazy long */ /* we just ignore names for nicks that are crazy long */
if (len + 2 < NAMESIZE) if (len + 2 < NAMESIZE)
hash_insert(&channel->ovmasks, nick, (void *)ovmask); hash_insert(&channel->ovmasks, nick, (void *)ovmask);
free(nick);
while (*eon && *eon == ' ') while (*eon && *eon == ' ')
eon++; eon++;

View File

@ -658,7 +658,7 @@ void *hash_it_remove(hash_iterator_t *hi)
void hash_dump(hash_t *h) void hash_dump(hash_t *h)
{ {
hash_iterator_t it; hash_iterator_t it;
for (hash_it_init(h, &it); hash_it_item(&it) ;hash_it_next(&it)) for (hash_it_init(h, &it); hash_it_key(&it) ;hash_it_next(&it))
printf("%s => %p\n", hash_it_key(&it), hash_it_item(&it)); printf("%s => %p\n", hash_it_key(&it), hash_it_item(&it));
} }