Browse Source

make free_*_messages() loops less obfuscated

notably, free_maildir_messages() had a dead assignment.
wip/maildir-path-under-inbox
Oswald Buddenhagen 3 years ago
parent
commit
b9f0162642
  1. 7
      src/driver.c
  2. 5
      src/drv_maildir.c

7
src/driver.c

@ -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;
}
}

5
src/drv_maildir.c

@ -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;
}
}

Loading…
Cancel
Save