mirror of
https://github.com/irssi/irssi.git
synced 2024-11-03 04:27:19 -05:00
correct GHashTable usage
This commit is contained in:
parent
1656dc1e54
commit
73b851c39c
@ -54,23 +54,26 @@ static void nick_hash_add(CHANNEL_REC *channel, NICK_REC *nick)
|
||||
|
||||
static void nick_hash_remove(CHANNEL_REC *channel, NICK_REC *nick)
|
||||
{
|
||||
NICK_REC *list;
|
||||
NICK_REC *list, *newlist;
|
||||
|
||||
list = g_hash_table_lookup(channel->nicks, nick->nick);
|
||||
if (list == NULL)
|
||||
return;
|
||||
|
||||
if (list == nick || list->next == NULL) {
|
||||
g_hash_table_remove(channel->nicks, nick->nick);
|
||||
if (list->next != NULL) {
|
||||
g_hash_table_insert(channel->nicks, nick->next->nick,
|
||||
nick->next);
|
||||
}
|
||||
if (list == nick) {
|
||||
newlist = nick->next;
|
||||
} else {
|
||||
newlist = list;
|
||||
while (list->next != nick)
|
||||
list = list->next;
|
||||
list->next = nick->next;
|
||||
}
|
||||
|
||||
g_hash_table_remove(channel->nicks, nick->nick);
|
||||
if (newlist != NULL) {
|
||||
g_hash_table_insert(channel->nicks, newlist->nick,
|
||||
newlist);
|
||||
}
|
||||
}
|
||||
|
||||
/* Add new nick to list */
|
||||
|
Loading…
Reference in New Issue
Block a user