Simplify client_next/prev
This commit is contained in:
parent
0477c5a8d6
commit
84a9519cbf
@ -92,24 +92,20 @@ client_configure(struct client *c)
|
|||||||
struct client*
|
struct client*
|
||||||
client_next(struct client *c)
|
client_next(struct client *c)
|
||||||
{
|
{
|
||||||
struct client *next;
|
struct client *next = SLIST_NEXT(c, tnext);
|
||||||
|
|
||||||
if(!(next = SLIST_NEXT(c, tnext)))
|
return (next ? next : SLIST_FIRST(&c->tag->clients));
|
||||||
next = SLIST_FIRST(&c->tag->clients);
|
|
||||||
|
|
||||||
return next;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
struct client*
|
struct client*
|
||||||
client_prev(struct client *c)
|
client_prev(struct client *c)
|
||||||
{
|
{
|
||||||
struct client *cc;
|
struct client *nc, *cc = SLIST_FIRST(&c->tag->clients);
|
||||||
|
|
||||||
|
while((nc = SLIST_NEXT(cc, tnext)) && nc != c)
|
||||||
|
cc = nc;
|
||||||
|
|
||||||
SLIST_FOREACH(cc, &c->tag->clients, tnext)
|
|
||||||
if(SLIST_NEXT(cc, tnext) == c || !SLIST_NEXT(cc, tnext))
|
|
||||||
return cc;
|
return cc;
|
||||||
|
|
||||||
return SLIST_FIRST(&c->tag->clients);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
struct client*
|
struct client*
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user