about summary refs log tree commit diff
path: root/src
diff options
context:
space:
mode:
authorDana Dahlstrom <dana+70@cs.ucsd.edu>2008-02-05 19:00:52 +0000
committerFlorian Westphal <fw@strlen.de>2008-02-26 23:49:33 +0100
commitc634303765c20083c8f554f4d4084526d3e58fef (patch)
tree7e4d2a861530448b1f6bf909e98400e5eeb7857f /src
parentcb0d594e6184694f8563f1e3116e3aac34606a86 (diff)
downloadngircd-c634303765c20083c8f554f4d4084526d3e58fef.tar.gz
ngircd-c634303765c20083c8f554f4d4084526d3e58fef.zip
Remove duplicate Channel_FirstChannelOf().
noticed there's a way to make the loop
slightly more elegant.

[fw@strlen.de: Extra () to silence gcc.]
Diffstat (limited to 'src')
-rw-r--r--src/ngircd/irc-channel.c9
1 files changed, 3 insertions, 6 deletions
diff --git a/src/ngircd/irc-channel.c b/src/ngircd/irc-channel.c
index 3481e19e..514af7fa 100644
--- a/src/ngircd/irc-channel.c
+++ b/src/ngircd/irc-channel.c
@@ -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;
 }