simplified detach()
f529d41c
1 file(s) · +3 −9
| 459 | 459 | ||
| 460 | 460 | void |
|
| 461 | 461 | detach(Client *c) { |
|
| 462 | - | Client *i; |
|
| 462 | + | Client **tc; |
|
| 463 | 463 | ||
| 464 | - | if (c != clients) { |
|
| 465 | - | for(i = clients; i->next != c; i = i->next); |
|
| 466 | - | i->next = c->next; |
|
| 467 | - | } |
|
| 468 | - | else { |
|
| 469 | - | clients = c->next; |
|
| 470 | - | } |
|
| 471 | - | c->next = NULL; |
|
| 464 | + | for(tc = &clients; *tc && *tc != c; tc = &(*tc)->next); |
|
| 465 | + | *tc = c->next; |
|
| 472 | 466 | } |
|
| 473 | 467 | ||
| 474 | 468 | void |