From 26006b4eb5519fba022ff03a9b8c82801496634c Mon Sep 17 00:00:00 2001 From: Brendan Cully Date: Thu, 12 Apr 2007 17:55:31 -0700 Subject: [PATCH] Only call mutt_set_flag when necessary when checking for maildir changes (fixes #1216) --- mh.c | 23 +++++++++++++---------- 1 file changed, 13 insertions(+), 10 deletions(-) diff --git a/mh.c b/mh.c index c12737ac3..3d60804b7 100644 --- a/mh.c +++ b/mh.c @@ -1726,16 +1726,19 @@ static void maildir_update_flags (CONTEXT *ctx, HEADER *o, HEADER *n) */ int context_changed = ctx->changed; - /* user didn't modify this message. alter the flags to - * match the current state on disk. This may not actually - * do anything, but we can't tell right now. mutt_set_flag() - * will just ignore the call if the status bits are - * already properly set. - */ - mutt_set_flag (ctx, o, M_FLAG, n->flagged); - mutt_set_flag (ctx, o, M_REPLIED, n->replied); - mutt_set_flag (ctx, o, M_READ, n->read); - mutt_set_flag (ctx, o, M_OLD, n->old); + /* user didn't modify this message. alter the flags to match the + * current state on disk. This may not actually do + * anything. mutt_set_flag() will just ignore the call if the status + * bits are already properly set, but it is still faster not to pass + * through it */ + if (o->flagged != n->flagged) + mutt_set_flag (ctx, o, M_FLAG, n->flagged); + if (o->replied != n->replied) + mutt_set_flag (ctx, o, M_REPLIED, n->replied); + if (o->read != n->read) + mutt_set_flag (ctx, o, M_READ, n->read); + if (o->old != n->old) + mutt_set_flag (ctx, o, M_OLD, n->old); /* mutt_set_flag() will set this, but we don't need to * sync the changes we made because we just updated the -- 2.50.1