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 void
free_generic_messages( message_t *msgs ) free_generic_messages( message_t *msgs )
{ {
message_t *tmsg; while (msgs) {
message_t *tmsg = msgs->next;
for (; msgs; msgs = tmsg) {
tmsg = msgs->next;
free( msgs->msgid ); free( msgs->msgid );
free( msgs ); free( msgs );
msgs = tmsg;
} }
} }

5
src/drv_maildir.c

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

Loading…
Cancel
Save