]> arthur.barton.de Git - ngircd-alex.git/commitdiff
Remove duplicate Channel_FirstChannelOf().
authorDana Dahlstrom <dana+70@cs.ucsd.edu>
Tue, 5 Feb 2008 19:00:52 +0000 (19:00 +0000)
committerFlorian Westphal <fw@strlen.de>
Tue, 26 Feb 2008 22:49:33 +0000 (23:49 +0100)
noticed there's a way to make the loop
slightly more elegant.

[fw@strlen.de: Extra () to silence gcc.]

src/ngircd/irc-channel.c

index 3481e19e66e617cb34039e00f35489cb8cd75dba..514af7fa99aac3cec11fe993b6d4b55d28a819b1 100644 (file)
@@ -14,7 +14,7 @@
 
 #include "portab.h"
 
-static char UNUSED id[] = "$Id: irc-channel.c,v 1.42 2008/02/05 13:31:50 fw Exp $";
+static char UNUSED id[] = "$Id: irc-channel.c,v 1.43 2008/02/05 19:00:52 fw Exp $";
 
 #include "imp.h"
 #include <assert.h>
@@ -51,16 +51,13 @@ static char UNUSED id[] = "$Id: irc-channel.c,v 1.42 2008/02/05 13:31:50 fw Exp
 static bool
 part_from_all_channels(CLIENT* client, CLIENT *target)
 {
-       CL2CHAN *cl2chan = Channel_FirstChannelOf(target);
+       CL2CHAN *cl2chan;
        CHANNEL *chan;
 
-       while (cl2chan) {
+       while ((cl2chan = Channel_FirstChannelOf(target))) {
                chan = Channel_GetChannel(cl2chan);
                assert( chan != NULL );
                Channel_Part(target, client, Channel_Name(chan), Client_ID(target));
-
-               /* next */
-               cl2chan = Channel_FirstChannelOf(target);
        }
        return CONNECTED;
 }