dovecot-2.2: lib-storage: Added data stack frames for most calls.

dovecot at dovecot.org dovecot at dovecot.org
Fri Oct 24 19:19:30 UTC 2014


details:   http://hg.dovecot.org/dovecot-2.2/rev/ce4ec584e756
changeset: 17995:ce4ec584e756
user:      Timo Sirainen <tss at iki.fi>
date:      Fri Oct 24 22:11:50 2014 +0300
description:
lib-storage: Added data stack frames for most calls.
So neither the callers nor the implementations need to worry about those so
much.

diffstat:

 src/lib-storage/mail-storage.c |  27 +++++++++++---
 src/lib-storage/mail.c         |  76 ++++++++++++++++++++++++++++++++++-------
 2 files changed, 83 insertions(+), 20 deletions(-)

diffs (241 lines):

diff -r 277dd641c533 -r ce4ec584e756 src/lib-storage/mail-storage.c
--- a/src/lib-storage/mail-storage.c	Fri Oct 24 22:10:25 2014 +0300
+++ b/src/lib-storage/mail-storage.c	Fri Oct 24 22:11:50 2014 +0300
@@ -1952,7 +1952,9 @@
 {
 	struct mail_save_context *ctx;
 
-	ctx = t->box->v.save_alloc(t);
+	T_BEGIN {
+		ctx = t->box->v.save_alloc(t);
+	} T_END;
 	i_assert(!ctx->unfinished);
 	ctx->unfinished = TRUE;
 	ctx->data.received_date = (time_t)-1;
@@ -2069,9 +2071,9 @@
 		mail_storage_set_error(box->storage, MAIL_ERROR_NOTPOSSIBLE,
 				       "Saving messages not supported");
 		ret = -1;
-	} else {
+	} else T_BEGIN {
 		ret = box->v.save_begin(*ctx, input);
-	}
+	} T_END;
 
 	if (ret < 0) {
 		mailbox_save_cancel(ctx);
@@ -2082,7 +2084,12 @@
 
 int mailbox_save_continue(struct mail_save_context *ctx)
 {
-	return ctx->transaction->box->v.save_continue(ctx);
+	int ret;
+
+	T_BEGIN {
+		ret = ctx->transaction->box->v.save_continue(ctx);
+	} T_END;
+	return ret;
 }
 
 static void
@@ -2119,7 +2126,9 @@
 	*_ctx = NULL;
 
 	ctx->finishing = TRUE;
-	ret = t->box->v.save_finish(ctx);
+	T_BEGIN {
+		ret = t->box->v.save_finish(ctx);
+	} T_END;
 	ctx->finishing = FALSE;
 
 	if (ret == 0 && !copying_via_save) {
@@ -2141,7 +2150,9 @@
 	struct mail_private *mail;
 
 	*_ctx = NULL;
-	ctx->transaction->box->v.save_cancel(ctx);
+	T_BEGIN {
+		ctx->transaction->box->v.save_cancel(ctx);
+	} T_END;
 	if (keywords != NULL && !ctx->finishing)
 		mailbox_keywords_unref(&keywords);
 	if (ctx->dest_mail != NULL) {
@@ -2185,7 +2196,9 @@
 		return -1;
 	}
 	ctx->finishing = TRUE;
-	ret = t->box->v.copy(ctx, backend_mail);
+	T_BEGIN {
+		ret = t->box->v.copy(ctx, backend_mail);
+	} T_END;
 	ctx->finishing = FALSE;
 	if (ret == 0) {
 		if (pvt_flags != 0)
diff -r 277dd641c533 -r ce4ec584e756 src/lib-storage/mail.c
--- a/src/lib-storage/mail.c	Fri Oct 24 22:10:25 2014 +0300
+++ b/src/lib-storage/mail.c	Fri Oct 24 22:11:50 2014 +0300
@@ -59,8 +59,12 @@
 bool mail_prefetch(struct mail *mail)
 {
 	struct mail_private *p = (struct mail_private *)mail;
+	bool ret;
 
-	return p->v.prefetch(mail);
+	T_BEGIN {
+		ret = p->v.prefetch(mail);
+	} T_END;
+	return ret;
 }
 
 void mail_add_temp_wanted_fields(struct mail *mail,
@@ -110,75 +114,115 @@
 int mail_get_parts(struct mail *mail, struct message_part **parts_r)
 {
 	struct mail_private *p = (struct mail_private *)mail;
+	int ret;
 
-	return p->v.get_parts(mail, parts_r);
+	T_BEGIN {
+		ret = p->v.get_parts(mail, parts_r);
+	} T_END;
+	return ret;
 }
 
 int mail_get_date(struct mail *mail, time_t *date_r, int *timezone_r)
 {
 	struct mail_private *p = (struct mail_private *)mail;
+	int ret;
 
-	return p->v.get_date(mail, date_r, timezone_r);
+	T_BEGIN {
+		ret = p->v.get_date(mail, date_r, timezone_r);
+	} T_END;
+	return ret;
 }
 
 int mail_get_received_date(struct mail *mail, time_t *date_r)
 {
 	struct mail_private *p = (struct mail_private *)mail;
+	int ret;
 
-	return p->v.get_received_date(mail, date_r);
+	T_BEGIN {
+		ret = p->v.get_received_date(mail, date_r);
+	} T_END;
+	return ret;
 }
 
 int mail_get_save_date(struct mail *mail, time_t *date_r)
 {
 	struct mail_private *p = (struct mail_private *)mail;
+	int ret;
 
-	return p->v.get_save_date(mail, date_r);
+	T_BEGIN {
+		ret = p->v.get_save_date(mail, date_r);
+	} T_END;
+	return ret;
 }
 
 int mail_get_virtual_size(struct mail *mail, uoff_t *size_r)
 {
 	struct mail_private *p = (struct mail_private *)mail;
+	int ret;
 
-	return p->v.get_virtual_size(mail, size_r);
+	T_BEGIN {
+		ret = p->v.get_virtual_size(mail, size_r);
+	} T_END;
+	return ret;
 }
 
 int mail_get_physical_size(struct mail *mail, uoff_t *size_r)
 {
 	struct mail_private *p = (struct mail_private *)mail;
+	int ret;
 
-	return p->v.get_physical_size(mail, size_r);
+	T_BEGIN {
+		ret = p->v.get_physical_size(mail, size_r);
+	} T_END;
+	return ret;
 }
 
 int mail_get_first_header(struct mail *mail, const char *field,
 			  const char **value_r)
 {
 	struct mail_private *p = (struct mail_private *)mail;
+	int ret;
 
-	return p->v.get_first_header(mail, field, FALSE, value_r);
+	T_BEGIN {
+		ret = p->v.get_first_header(mail, field, FALSE, value_r);
+	} T_END;
+	return ret;
 }
 
 int mail_get_first_header_utf8(struct mail *mail, const char *field,
 			       const char **value_r)
 {
 	struct mail_private *p = (struct mail_private *)mail;
+	int ret;
 
-	return p->v.get_first_header(mail, field, TRUE, value_r);
+	T_BEGIN {
+		ret = p->v.get_first_header(mail, field, TRUE, value_r);
+	} T_END;
+	return ret;
 }
 
 int mail_get_headers(struct mail *mail, const char *field,
 		     const char *const **value_r)
 {
 	struct mail_private *p = (struct mail_private *)mail;
+	int ret;
 
-	return p->v.get_headers(mail, field, FALSE, value_r);
+	T_BEGIN {
+		ret = p->v.get_headers(mail, field, FALSE, value_r);
+	} T_END;
+	return ret;
 }
 
 int mail_get_headers_utf8(struct mail *mail, const char *field,
 			  const char *const **value_r)
 {
 	struct mail_private *p = (struct mail_private *)mail;
+	int ret;
 
-	return p->v.get_headers(mail, field, TRUE, value_r);
+	T_BEGIN {
+		ret = p->v.get_headers(mail, field, TRUE, value_r);
+	} T_END;
+	return ret;
 }
 
 int mail_get_header_stream(struct mail *mail,
@@ -186,8 +230,12 @@
 			   struct istream **stream_r)
 {
 	struct mail_private *p = (struct mail_private *)mail;
+	int ret;
 
-	return p->v.get_header_stream(mail, headers, stream_r);
+	T_BEGIN {
+		ret = p->v.get_header_stream(mail, headers, stream_r);
+	} T_END;
+	return ret;
 }
 
 void mail_set_aborted(struct mail *mail)
@@ -333,7 +381,9 @@
 {
 	struct mail_private *p = (struct mail_private *)mail;
 
-	p->v.expunge(mail);
+	T_BEGIN {
+		p->v.expunge(mail);
+	} T_END;
 }
 
 void mail_set_expunged(struct mail *mail)


More information about the dovecot-cvs mailing list