From: Timo Sirainen Date: Mon, 21 Nov 2016 12:02:11 +0000 (+0200) Subject: quota-clone: Code cleanup - moved recursion check to quota_clone_flush() X-Git-Tag: 2.2.27~79 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=ad10b85c8c14c41ba3e002adaac8edcf00f13fe3;p=thirdparty%2Fdovecot%2Fcore.git quota-clone: Code cleanup - moved recursion check to quota_clone_flush() --- diff --git a/src/plugins/quota-clone/quota-clone-plugin.c b/src/plugins/quota-clone/quota-clone-plugin.c index e2b5b760ab..94cddb7618 100644 --- a/src/plugins/quota-clone/quota-clone-plugin.c +++ b/src/plugins/quota-clone/quota-clone-plugin.c @@ -32,7 +32,7 @@ struct quota_clone_mailbox { bool quota_changed; }; -static void quota_clone_flush(struct mailbox *box) +static void quota_clone_flush_real(struct mailbox *box) { struct quota_clone_mailbox *qbox = QUOTA_CLONE_CONTEXT(box); struct quota_clone_user *quser = @@ -76,6 +76,21 @@ static void quota_clone_flush(struct mailbox *box) qbox->quota_changed = FALSE; } +static void quota_clone_flush(struct mailbox *box) +{ + struct quota_clone_mailbox *qbox = QUOTA_CLONE_CONTEXT(box); + struct quota_clone_user *quser = + QUOTA_CLONE_USER_CONTEXT(box->storage->user); + + if (quser->quota_flushing) { + /* recursing back from quota recalculation */ + } else if (qbox->quota_changed) { + quser->quota_flushing = TRUE; + quota_clone_flush_real(box); + quser->quota_flushing = FALSE; + } +} + static int quota_clone_save_finish(struct mail_save_context *ctx) { struct quota_clone_mailbox *qbox = @@ -111,18 +126,10 @@ quota_clone_mailbox_sync_notify(struct mailbox *box, uint32_t uid, static void quota_clone_mailbox_close(struct mailbox *box) { struct quota_clone_mailbox *qbox = QUOTA_CLONE_CONTEXT(box); - struct quota_clone_user *quser = - QUOTA_CLONE_USER_CONTEXT(box->storage->user); qbox->module_ctx.super.close(box); - if (quser->quota_flushing) { - /* recursing back from quota recalculation */ - } else if (qbox->quota_changed) { - quser->quota_flushing = TRUE; - quota_clone_flush(box); - quser->quota_flushing = FALSE; - } + quota_clone_flush(box); } static void quota_clone_mailbox_allocated(struct mailbox *box)