Clean up (reformat and comment) Delete_Channel() function.
This commit is contained in:
parent
18efc7469c
commit
0659503afd
|
@ -1067,22 +1067,24 @@ Get_Next_Cl2Chan( CL2CHAN *Start, CLIENT *Client, CHANNEL *Channel )
|
||||||
} /* Get_Next_Cl2Chan */
|
} /* Get_Next_Cl2Chan */
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Remove a channel and free all of its data structures.
|
||||||
|
*/
|
||||||
static bool
|
static bool
|
||||||
Delete_Channel(CHANNEL *Chan)
|
Delete_Channel(CHANNEL *Chan)
|
||||||
{
|
{
|
||||||
/* delete channel structure */
|
|
||||||
|
|
||||||
CHANNEL *chan, *last_chan;
|
CHANNEL *chan, *last_chan;
|
||||||
|
|
||||||
last_chan = NULL;
|
last_chan = NULL;
|
||||||
chan = My_Channels;
|
chan = My_Channels;
|
||||||
while( chan )
|
while (chan) {
|
||||||
{
|
if (chan == Chan)
|
||||||
if( chan == Chan ) break;
|
break;
|
||||||
last_chan = chan;
|
last_chan = chan;
|
||||||
chan = chan->next;
|
chan = chan->next;
|
||||||
}
|
}
|
||||||
if( ! chan ) return false;
|
if (!chan)
|
||||||
|
return false;
|
||||||
|
|
||||||
Log(LOG_DEBUG, "Freed channel structure for \"%s\".", Chan->name);
|
Log(LOG_DEBUG, "Freed channel structure for \"%s\".", Chan->name);
|
||||||
|
|
||||||
|
@ -1091,11 +1093,14 @@ Delete_Channel( CHANNEL *Chan )
|
||||||
Lists_Free(&chan->list_invites);
|
Lists_Free(&chan->list_invites);
|
||||||
|
|
||||||
/* maintain channel list */
|
/* maintain channel list */
|
||||||
if( last_chan ) last_chan->next = chan->next;
|
if (last_chan)
|
||||||
else My_Channels = chan->next;
|
last_chan->next = chan->next;
|
||||||
|
else
|
||||||
|
My_Channels = chan->next;
|
||||||
free(chan);
|
free(chan);
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
} /* Delete_Channel */
|
} /* Delete_Channel */
|
||||||
|
|
||||||
|
|
||||||
/* -eof- */
|
/* -eof- */
|
||||||
|
|
Loading…
Reference in New Issue