Skip to content

Commit

Permalink
lib-storage: convert struct pop3_mail casts to container_of
Browse files Browse the repository at this point in the history
  • Loading branch information
Josef 'Jeff' Sipek authored and Timo Sirainen committed Sep 18, 2017
1 parent 7dd326f commit 120e61c
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 3 deletions.
6 changes: 3 additions & 3 deletions src/lib-storage/index/pop3c/pop3c-mail.c
Expand Up @@ -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 */
Expand Down Expand Up @@ -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;
Expand Down Expand Up @@ -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;
Expand Down
1 change: 1 addition & 0 deletions src/lib-storage/index/pop3c/pop3c-storage.h
Expand Up @@ -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,
Expand Down

0 comments on commit 120e61c

Please sign in to comment.