Commit Diff


commit - 45768ee04bfab45a5dfd21105419806422ca8954
commit + f529d41ca1792455bbae29e008af3c27c3a49df5
blob - 1554a166f3a6fcd2a78d07fdcec190e862196de3
blob + 3d9a0637bfe2ccc672b93e3d528d0011c7292f3f
--- dwm.c
+++ dwm.c
@@ -459,16 +459,10 @@ destroynotify(XEvent *e) {
 
 void
 detach(Client *c) {
-	Client *i;
+	Client **tc;
 
-	if (c != clients) {
-		for(i = clients; i->next != c; i = i->next);
-		i->next = c->next;
-	}
-	else {
-		clients = c->next;
-	}
-	c->next =  NULL;
+	for(tc = &clients; *tc && *tc != c; tc = &(*tc)->next);
+	*tc = c->next;
 }
 
 void