]> git.ipfire.org Git - thirdparty/dovecot/core.git/commitdiff
lib-storage: convert struct pop3_mail casts to container_of
authorJosef 'Jeff' Sipek <jeff.sipek@dovecot.fi>
Thu, 7 Sep 2017 11:26:51 +0000 (14:26 +0300)
committerTimo Sirainen <tss@dovecot.fi>
Mon, 18 Sep 2017 14:40:24 +0000 (17:40 +0300)
src/lib-storage/index/pop3c/pop3c-mail.c
src/lib-storage/index/pop3c/pop3c-storage.h

index efd44e8a57dcab04508b21ae09b5d6245cd479a6..b0078b277413ac976da0d9152017e43f3435e18b 100644 (file)
@@ -26,7 +26,7 @@ pop3c_mail_alloc(struct mailbox_transaction_context *t,
 
 static void pop3c_mail_close(struct mail *_mail)
 {
-       struct pop3c_mail *pmail = (struct pop3c_mail *)_mail;
+       struct pop3c_mail *pmail = POP3C_MAIL(_mail);
        struct pop3c_mailbox *mbox = POP3C_MAILBOX(_mail->box);
 
        /* wait for any prefetch to finish before closing the mail */
@@ -140,7 +140,7 @@ pop3c_mail_prefetch_done(enum pop3c_command_state state,
 
 static bool pop3c_mail_prefetch(struct mail *_mail)
 {
-       struct pop3c_mail *pmail = (struct pop3c_mail *)_mail;
+       struct pop3c_mail *pmail = POP3C_MAIL(_mail);
        struct pop3c_mailbox *mbox = POP3C_MAILBOX(_mail->box);
        enum pop3c_capability capa;
        const char *cmd;
@@ -170,7 +170,7 @@ pop3c_mail_get_stream(struct mail *_mail, bool get_body,
                      struct message_size *hdr_size,
                      struct message_size *body_size, struct istream **stream_r)
 {
-       struct pop3c_mail *pmail = (struct pop3c_mail *)_mail;
+       struct pop3c_mail *pmail = POP3C_MAIL(_mail);
        struct index_mail *mail = &pmail->imail;
        struct pop3c_mailbox *mbox = POP3C_MAILBOX(_mail->box);
        enum pop3c_capability capa;
index 33d07d1ce8eb71b0d83a7d38d6a40ae39ecba9e7..f271a59c5320b09997a7f344c66bd037f1e8eee9 100644 (file)
@@ -39,6 +39,7 @@ struct pop3c_mail {
 
 #define POP3C_STORAGE(s)       container_of(s, struct pop3c_storage, storage)
 #define POP3C_MAILBOX(s)       container_of(s, struct pop3c_mailbox, box)
+#define POP3C_MAIL(s)          container_of(s, struct pop3c_mail, imail.mail.mail)
 
 struct mail *
 pop3c_mail_alloc(struct mailbox_transaction_context *t,