[dovecot-cvs] dovecot/src/lib-sql driver-mysql.c, 1.20, 1.21 sql-api-private.h, 1.7, 1.8 sql-api.c, 1.9, 1.10

cras at dovecot.org cras at dovecot.org
Wed Jun 28 16:10:49 EEST 2006


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

Modified Files:
	driver-mysql.c sql-api-private.h sql-api.c 
Log Message:
Array API redesigned to work using unions. It now provides type safety
without having to enable DEBUG, as long as the compiler supports typeof().
Its API changed a bit. It now allows directly accessing the array contents,
although that's not necessarily recommended. Changed existing array usage to
be type safe in a bit more places. Removed array_t completely. Also did
s/modifyable/modifiable/.



Index: driver-mysql.c
===================================================================
RCS file: /var/lib/cvs/dovecot/src/lib-sql/driver-mysql.c,v
retrieving revision 1.20
retrieving revision 1.21
diff -u -d -r1.20 -r1.21
--- driver-mysql.c	17 Jun 2006 12:20:21 -0000	1.20
+++ driver-mysql.c	28 Jun 2006 13:10:46 -0000	1.21
@@ -33,7 +33,7 @@
 	const char *ssl_cert, *ssl_key, *ssl_ca, *ssl_ca_path, *ssl_cipher;
 	unsigned int port, client_flags;
 
-	array_t ARRAY_DEFINE(connections, struct mysql_connection);
+	ARRAY_DEFINE(connections, struct mysql_connection);
 	unsigned int next_query_connection;
 };
 
@@ -150,7 +150,7 @@
 	unsigned int i, count;
 	int ret = -1;
 
-	conn = array_get_modifyable(&db->connections, &count);
+	conn = array_get_modifiable(&db->connections, &count);
 	for (i = 0; i < count; i++) {
 		if (driver_mysql_connect(&conn[i]))
 			ret = 1;
@@ -260,7 +260,7 @@
 	struct mysql_connection *conn;
 	unsigned int i, count;
 
-	conn = array_get_modifyable(&db->connections, &count);
+	conn = array_get_modifiable(&db->connections, &count);
 	for (i = 0; i < count; i++)
 		(void)driver_mysql_connection_free(&conn[i]);
 
@@ -309,7 +309,7 @@
 	bool reset;
 	int ret;
 
-	conn = array_get_modifyable(&db->connections, &count);
+	conn = array_get_modifiable(&db->connections, &count);
 
 	/* go through the connections in round robin. if the connection
 	   isn't available, try next one that is. */
@@ -354,7 +354,7 @@
 
 	/* All the connections should be identical, so just use the first
 	   connected one */
-	conn = array_get_modifyable(&db->connections, &count);
+	conn = array_get_modifiable(&db->connections, &count);
 	for (i = 0; i < count; i++) {
 		if (conn[i].connected)
 			break;

Index: sql-api-private.h
===================================================================
RCS file: /var/lib/cvs/dovecot/src/lib-sql/sql-api-private.h,v
retrieving revision 1.7
retrieving revision 1.8
diff -u -d -r1.7 -r1.8
--- sql-api-private.h	31 May 2006 11:02:50 -0000	1.7
+++ sql-api-private.h	28 Jun 2006 13:10:46 -0000	1.8
@@ -55,7 +55,9 @@
 	struct sql_db *db;
 };
 
-extern array_t ARRAY_DEFINE(sql_drivers, const struct sql_db *);
+ARRAY_DEFINE_TYPE(sql_drivers, const struct sql_db *);
+
+extern ARRAY_TYPE(sql_drivers) sql_drivers;
 extern struct sql_result sql_not_connected_result;
 
 #endif

Index: sql-api.c
===================================================================
RCS file: /var/lib/cvs/dovecot/src/lib-sql/sql-api.c,v
retrieving revision 1.9
retrieving revision 1.10
diff -u -d -r1.9 -r1.10
--- sql-api.c	31 May 2006 11:02:50 -0000	1.9
+++ sql-api.c	28 Jun 2006 13:10:46 -0000	1.10
@@ -4,7 +4,7 @@
 #include "array.h"
 #include "sql-api-private.h"
 
-array_t ARRAY_DEFINE(sql_drivers, const struct sql_db *);
+ARRAY_TYPE(sql_drivers) sql_drivers;
 
 void sql_drivers_init(void)
 {



More information about the dovecot-cvs mailing list