degesch: cleanup

This commit is contained in:
Přemysl Eric Janouch 2021-07-23 18:30:13 +02:00
parent 051c43a072
commit acddfe2cfa
Signed by: p
GPG Key ID: A0420B94F92B9493

View File

@ -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');