dovecot-2.2: dict-sql: Code cleanup - use a common sql_dict_tran...

dovecot at dovecot.org dovecot at dovecot.org
Wed Sep 2 14:28:17 UTC 2015


details:   http://hg.dovecot.org/dovecot-2.2/rev/cb6d6d861ffa
changeset: 19062:cb6d6d861ffa
user:      Timo Sirainen <tss at iki.fi>
date:      Wed Sep 02 17:27:09 2015 +0300
description:
dict-sql: Code cleanup - use a common sql_dict_transaction_free()

diffstat:

 src/lib-dict/dict-sql.c |  19 ++++++++++---------
 1 files changed, 10 insertions(+), 9 deletions(-)

diffs (43 lines):

diff -r 5c444f10cef9 -r cb6d6d861ffa src/lib-dict/dict-sql.c
--- a/src/lib-dict/dict-sql.c	Wed Sep 02 17:26:08 2015 +0300
+++ b/src/lib-dict/dict-sql.c	Wed Sep 02 17:27:09 2015 +0300
@@ -529,6 +529,14 @@
 	return &ctx->ctx;
 }
 
+static void sql_dict_transaction_free(struct sql_dict_transaction_context *ctx)
+{
+	if (ctx->inc_row_pool != NULL)
+		pool_unref(&ctx->inc_row_pool);
+	i_free(ctx->prev_inc_key);
+	i_free(ctx);
+}
+
 static int
 sql_dict_transaction_commit(struct dict_transaction_context *_ctx,
 			    bool async ATTR_UNUSED,
@@ -564,10 +572,7 @@
 			}
 		}
 	}
-	if (ctx->inc_row_pool != NULL)
-		pool_unref(&ctx->inc_row_pool);
-	i_free(ctx->prev_inc_key);
-	i_free(ctx);
+	sql_dict_transaction_free(ctx);
 
 	if (callback != NULL)
 		callback(ret, context);
@@ -580,11 +585,7 @@
 		(struct sql_dict_transaction_context *)_ctx;
 
 	sql_transaction_rollback(&ctx->sql_ctx);
-
-	if (ctx->inc_row_pool != NULL)
-		pool_unref(&ctx->inc_row_pool);
-	i_free(ctx->prev_inc_key);
-	i_free(ctx);
+	sql_dict_transaction_free(ctx);
 }
 
 struct dict_sql_build_query_field {


More information about the dovecot-cvs mailing list