summaryrefslogtreecommitdiff
path: root/degesch.c
diff options
context:
space:
mode:
Diffstat (limited to 'degesch.c')
-rw-r--r--degesch.c16
1 files changed, 6 insertions, 10 deletions
diff --git a/degesch.c b/degesch.c
index fb3cee3..846d08f 100644
--- a/degesch.c
+++ b/degesch.c
@@ -7592,17 +7592,13 @@ channel_user_sort_entry_cmp (const void *entry_a, const void *entry_b)
static char *
make_channel_users_list (struct channel *channel)
{
- size_t n_users = 0;
- LIST_FOR_EACH (struct channel_user, iter, channel->users)
- n_users++;
-
- struct channel_user_sort_entry entries[n_users];
- size_t i = 0;
+ size_t n_users = channel->users_len;
+ struct channel_user_sort_entry entries[n_users], *p = entries;
LIST_FOR_EACH (struct channel_user, iter, channel->users)
{
- entries[i].s = channel->s;
- entries[i].channel_user = iter;
- i++;
+ p->s = channel->s;
+ p->channel_user = iter;
+ p++;
}
qsort (entries, n_users, sizeof *entries, channel_user_sort_entry_cmp);
@@ -7610,7 +7606,7 @@ make_channel_users_list (struct channel *channel)
// Make names of users that are away italicised, constructing a formatter
// and adding a new attribute seems like unnecessary work
struct str list = str_make ();
- for (i = 0; i < n_users; i++)
+ for (size_t i = 0; i < n_users; i++)
{
struct channel_user *channel_user = entries[i].channel_user;
if (channel_user->user->away) str_append_c (&list, '\x1d');