diff options
author | nicm <nicm> | 2015-04-24 23:17:11 +0000 |
---|---|---|
committer | nicm <nicm> | 2015-04-24 23:17:11 +0000 |
commit | aeedb464a6ee038289ddcfefae437928ab020cb1 (patch) | |
tree | 0428a0446bd50d08e4b0fe6741644e36d8b1a071 /cmd-detach-client.c | |
parent | 583b4ab72b7bf66fda8ab63a08fe435483de5e5a (diff) | |
download | rtmux-aeedb464a6ee038289ddcfefae437928ab020cb1.tar.gz rtmux-aeedb464a6ee038289ddcfefae437928ab020cb1.tar.bz2 rtmux-aeedb464a6ee038289ddcfefae437928ab020cb1.zip |
Convert clients list into a TAILQ.
Diffstat (limited to 'cmd-detach-client.c')
-rw-r--r-- | cmd-detach-client.c | 13 |
1 files changed, 4 insertions, 9 deletions
diff --git a/cmd-detach-client.c b/cmd-detach-client.c index 7f87d2c6..4bae9997 100644 --- a/cmd-detach-client.c +++ b/cmd-detach-client.c @@ -51,7 +51,6 @@ cmd_detach_client_exec(struct cmd *self, struct cmd_q *cmdq) struct client *c, *cloop; struct session *s; enum msgtype msgtype; - u_int i; if (self->entry == &cmd_suspend_client_entry) { if ((c = cmd_find_client(cmdq, args_get(args, 't'), 0)) == NULL) @@ -72,9 +71,8 @@ cmd_detach_client_exec(struct cmd *self, struct cmd_q *cmdq) if (s == NULL) return (CMD_RETURN_ERROR); - for (i = 0; i < ARRAY_LENGTH(&clients); i++) { - cloop = ARRAY_ITEM(&clients, i); - if (cloop == NULL || cloop->session != s) + TAILQ_FOREACH(cloop, &clients, entry) { + if (cloop->session != s) continue; server_write_client(cloop, msgtype, cloop->session->name, @@ -88,11 +86,8 @@ cmd_detach_client_exec(struct cmd *self, struct cmd_q *cmdq) return (CMD_RETURN_ERROR); if (args_has(args, 'a')) { - for (i = 0; i < ARRAY_LENGTH(&clients); i++) { - cloop = ARRAY_ITEM(&clients, i); - if (cloop == NULL || cloop->session == NULL) - continue; - if (cloop == c) + TAILQ_FOREACH(cloop, &clients, entry) { + if (cloop->session == NULL || cloop == c) continue; server_write_client(cloop, msgtype, cloop->session->name, |