[dovecot-cvs] dovecot/src/lib-sql sql-api.c, 1.13, 1.14 sql-api.h, 1.10, 1.11

tss at dovecot.org tss at dovecot.org
Fri Dec 15 16:55:45 UTC 2006


Update of /var/lib/cvs/dovecot/src/lib-sql
In directory talvi:/tmp/cvs-serv346/lib-sql

Modified Files:
	sql-api.c sql-api.h 
Log Message:
Added context parameter type safety checks for most callback APIs.



Index: sql-api.c
===================================================================
RCS file: /var/lib/cvs/dovecot/src/lib-sql/sql-api.c,v
retrieving revision 1.13
retrieving revision 1.14
diff -u -d -r1.13 -r1.14
--- sql-api.c	10 Sep 2006 12:48:22 -0000	1.13
+++ sql-api.c	15 Dec 2006 16:55:43 -0000	1.14
@@ -76,6 +76,7 @@
 	db->exec(db, query);
 }
 
+#undef sql_query
 void sql_query(struct sql_db *db, const char *query,
 	       sql_query_callback_t *callback, void *context)
 {
@@ -157,6 +158,7 @@
 	return db->transaction_begin(db);
 }
 
+#undef sql_transaction_commit
 void sql_transaction_commit(struct sql_transaction_context **_ctx,
 			    sql_commit_callback_t *callback, void *context)
 {

Index: sql-api.h
===================================================================
RCS file: /var/lib/cvs/dovecot/src/lib-sql/sql-api.h,v
retrieving revision 1.10
retrieving revision 1.11
diff -u -d -r1.10 -r1.11
--- sql-api.h	1 Jul 2006 17:24:11 -0000	1.10
+++ sql-api.h	15 Dec 2006 16:55:43 -0000	1.11
@@ -45,6 +45,9 @@
 /* Execute SQL query and return result in callback. */
 void sql_query(struct sql_db *db, const char *query,
 	       sql_query_callback_t *callback, void *context);
+#define sql_query(db, query, callback, context) \
+	CONTEXT_CALLBACK2(sql_query, sql_query_callback_t, \
+			  callback, context, db, query)
 /* Execute blocking SQL query and return result. */
 struct sql_result *sql_query_s(struct sql_db *db, const char *query);
 
@@ -80,6 +83,9 @@
 /* Commit transaction. */
 void sql_transaction_commit(struct sql_transaction_context **ctx,
 			    sql_commit_callback_t *callback, void *context);
+#define sql_transaction_commit(ctx, callback, context) \
+	CONTEXT_CALLBACK2(sql_transaction_commit, sql_commit_callback_t, \
+			  callback, context, ctx)
 /* Synchronous commit. Returns 0 if ok, -1 if error. */
 int sql_transaction_commit_s(struct sql_transaction_context **ctx,
 			     const char **error_r);



More information about the dovecot-cvs mailing list