make free_*_messages() loops less obfuscated

notably, free_maildir_messages() had a dead assignment.
This commit is contained in:
Oswald Buddenhagen 2022-06-02 18:42:07 +02:00
parent 35375df63f
commit b9f0162642
2 changed files with 6 additions and 6 deletions

View File

@ -24,12 +24,11 @@ count_generic_messages( message_t *msgs )
void
free_generic_messages( message_t *msgs )
{
message_t *tmsg;
for (; msgs; msgs = tmsg) {
tmsg = msgs->next;
while (msgs) {
message_t *tmsg = msgs->next;
free( msgs->msgid );
free( msgs );
msgs = tmsg;
}
}

View File

@ -251,11 +251,12 @@ maildir_connect_store( store_t *gctx,
static void
free_maildir_messages( maildir_message_t *msg )
{
for (maildir_message_t *tmsg; (tmsg = msg); msg = tmsg) {
tmsg = msg->next;
while (msg) {
maildir_message_t *tmsg = msg->next;
free( msg->base );
free( msg->msgid );
free( msg );
msg = tmsg;
}
}