summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--dwm.c12
1 files changed, 3 insertions, 9 deletions
diff --git a/dwm.c b/dwm.c
index 1554a166..3d9a0637 100644
--- a/dwm.c
+++ b/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