Hi,

Evolution left this function with vestiges of long lost limbs.
It was a bit hard to understand, so I applied some intelligent
design to it.  In the process it was optimized (after the first
non-matching client is found, the loop breaks).

Vadik.

-- 
To the systems programmer, users and applications serve only to
provide a test load.
Index: group.c
===================================================================
RCS file: /cvs/xenocara/app/cwm/group.c,v
retrieving revision 1.121
diff -u -r1.121 group.c
--- group.c	10 Nov 2015 20:05:33 -0000	1.121
+++ group.c	6 Dec 2015 14:06:27 -0000
@@ -209,19 +209,12 @@
 group_holds_only_hidden(struct group_ctx *gc)
 {
 	struct client_ctx	*cc;
-	int			 hidden = 0, same = 0;
 
 	TAILQ_FOREACH(cc, &gc->clientq, group_entry) {
-		if (cc->flags & CLIENT_STICKY)
-			continue;
-		if (hidden == ((cc->flags & CLIENT_HIDDEN) ? 1 : 0))
-			same++;
+		if (!(cc->flags & (CLIENT_HIDDEN | CLIENT_STICKY)))
+			return(0);
 	}
-
-	if (same == 0)
-		hidden = !hidden;
-
-	return(hidden);
+	return(1);
 }
 
 void

Reply via email to