From 0c9b76b0d6924a030db9a7f45792b95d17251696 Mon Sep 17 00:00:00 2001 From: okan Date: Fri, 2 Sep 2016 16:07:11 +0000 Subject: Simplify group_holds_only_hidden(); from Vadim Vygonets. --- group.c | 15 ++++----------- 1 file changed, 4 insertions(+), 11 deletions(-) (limited to 'group.c') diff --git a/group.c b/group.c index a671f33..93c72b9 100644 --- a/group.c +++ b/group.c @@ -16,7 +16,7 @@ * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. * - * $OpenBSD: group.c,v 1.121 2015/11/10 20:05:33 okan Exp $ + * $OpenBSD: group.c,v 1.122 2016/09/02 16:07:11 okan Exp $ */ #include @@ -209,19 +209,12 @@ int 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 -- cgit v1.2.3-2-gb3c3