]> git.ipfire.org Git - thirdparty/dovecot/core.git/commitdiff
snarf: Contexts are now required or checked
authorAki Tuomi <aki.tuomi@dovecot.fi>
Sun, 14 Jan 2018 18:07:31 +0000 (20:07 +0200)
committerAki Tuomi <aki.tuomi@open-xchange.com>
Thu, 18 Jan 2018 08:41:18 +0000 (10:41 +0200)
Satisfies static analyzers

src/plugins/snarf/snarf-plugin.c

index c6fa7fc02c706687f62a9bea01290907019b877b..3646c33cae6729c21eabac9d7af989ed9a458266 100644 (file)
@@ -10,6 +10,8 @@
 
 #define SNARF_CONTEXT(obj) \
        MODULE_CONTEXT(obj, snarf_storage_module)
+#define SNARF_CONTEXT_REQUIRE(obj) \
+       MODULE_CONTEXT_REQUIRE(obj, snarf_storage_module)
 
 struct snarf_mail_storage {
        union mail_storage_module_context module_ctx;
@@ -102,7 +104,7 @@ static int snarf(struct mailbox *srcbox, struct mailbox *destbox)
 static struct mailbox_sync_context *
 snarf_sync_init(struct mailbox *box, enum mailbox_sync_flags flags)
 {
-       struct snarf_mailbox *sbox = SNARF_CONTEXT(box);
+       struct snarf_mailbox *sbox = SNARF_CONTEXT_REQUIRE(box);
 
        (void)snarf(sbox->snarf_box, box);
        /* close the mailbox so that we don't have to keep it locked */
@@ -112,7 +114,7 @@ snarf_sync_init(struct mailbox *box, enum mailbox_sync_flags flags)
 
 static void snarf_mailbox_free(struct mailbox *box)
 {
-       struct snarf_mailbox *sbox = SNARF_CONTEXT(box);
+       struct snarf_mailbox *sbox = SNARF_CONTEXT_REQUIRE(box);
 
        mailbox_free(&sbox->snarf_box);
        sbox->module_ctx.super.free(box);
@@ -172,7 +174,7 @@ snarf_mailbox_alloc(struct mail_storage *storage,
                    struct mailbox_list *list,
                    const char *vname, enum mailbox_flags flags)
 {
-       struct snarf_mail_storage *sstorage = SNARF_CONTEXT(storage);
+       struct snarf_mail_storage *sstorage = SNARF_CONTEXT_REQUIRE(storage);
        struct mail_namespace *ns = mailbox_list_get_namespace(list);
        struct mailbox *box;
        struct mailbox_list *snarf_list;