From acddfe2cfab3692f21824d1345479b9c88367e30 Mon Sep 17 00:00:00 2001 From: Přemysl Eric Janouch Date: Fri, 23 Jul 2021 18:30:13 +0200 Subject: degesch: cleanup --- degesch.c | 16 ++++++---------- 1 file changed, 6 insertions(+), 10 deletions(-) (limited to 'degesch.c') 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'); -- cgit v1.2.3-70-g09d2