瀏覽代碼

simplified detach()

Anselm R Garbe 17 年之前
父節點
當前提交
f529d41ca1
共有 1 個文件被更改,包括 3 次插入9 次删除
  1. 3 9
      dwm.c

+ 3 - 9
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