diff -r 5f55d9b819a2 -r 2c72f7c8826f dwm.c --- a/dwm.c Wed Jul 02 11:54:36 2008 +0100 +++ b/dwm.c Thu Jul 03 10:58:35 2008 +0100 @@ -459,16 +459,10 @@ 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