From a5d77dcacb2014541e12237bb84dc849c8158b20 Mon Sep 17 00:00:00 2001 From: Stephan Bosch <stephan.bosch@open-xchange.com> Date: Tue, 25 Aug 2020 22:28:06 +0200 Subject: [PATCH] testsuite: testsuite-mailstore - Return struct testsuite_mailstore_mail from testsuite_mailstore_open(). This is more flexible and needed in subsequent commit. --- src/testsuite/testsuite-mailstore.c | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) diff --git a/src/testsuite/testsuite-mailstore.c b/src/testsuite/testsuite-mailstore.c index 8708d4fd8..9c584246a 100644 --- a/src/testsuite/testsuite-mailstore.c +++ b/src/testsuite/testsuite-mailstore.c @@ -165,7 +165,8 @@ bool testsuite_mailstore_mailbox_create( return TRUE; } -static struct mail *testsuite_mailstore_open(const char *folder) +static struct testsuite_mailstore_mail * +testsuite_mailstore_open(const char *folder) { enum mailbox_flags flags = MAILBOX_FLAG_SAVEONLY | MAILBOX_FLAG_POST_SESSION; @@ -202,7 +203,7 @@ static struct mail *testsuite_mailstore_open(const char *folder) tmail->next = testsuite_mailstore_mail; testsuite_mailstore_mail = tmail; } - return tmail->mail; + return tmail; } box = mailbox_alloc(ns->list, folder, flags); @@ -235,7 +236,7 @@ static struct mail *testsuite_mailstore_open(const char *folder) tmail->trans = t; tmail->mail = mail_alloc(t, 0, NULL); - return tmail->mail; + return tmail; } static void testsuite_mailstore_free(bool all) @@ -272,13 +273,14 @@ void testsuite_mailstore_flush(void) bool testsuite_mailstore_mail_index(const struct sieve_runtime_env *renv, const char *folder, unsigned int index) { - struct mail *mail = testsuite_mailstore_open(folder); + struct testsuite_mailstore_mail *tmail; - if (mail == NULL) + tmail = testsuite_mailstore_open(folder); + if (tmail == NULL) return FALSE; - mail_set_seq(mail, index+1); - testsuite_message_set_mail(renv, mail); + mail_set_seq(tmail->mail, index+1); + testsuite_message_set_mail(renv, tmail->mail); return TRUE; } -- GitLab