Convert clients list into a TAILQ.

This commit is contained in:
nicm
2015-04-24 23:17:11 +00:00
parent 583b4ab72b
commit aeedb464a6
15 changed files with 118 additions and 223 deletions

View File

@ -51,7 +51,6 @@ cmd_attach_session(struct cmd_q *cmdq, const char *tflag, int dflag, int rflag,
struct window_pane *wp = NULL;
const char *update;
char *cause;
u_int i;
int fd;
struct format_tree *ft;
char *cp;
@ -92,11 +91,8 @@ cmd_attach_session(struct cmd_q *cmdq, const char *tflag, int dflag, int rflag,
* Can't use server_write_session in case attaching to
* the same session as currently attached to.
*/
for (i = 0; i < ARRAY_LENGTH(&clients); i++) {
c = ARRAY_ITEM(&clients, i);
if (c == NULL || c->session != s)
continue;
if (c == cmdq->client)
TAILQ_FOREACH(c, &clients, entry) {
if (c->session != s || c == cmdq->client)
continue;
server_write_client(c, MSG_DETACH,
c->session->name,