[dovecot-cvs] dovecot/src/plugins/quota quota-dirsize.c, 1.11, 1.12 quota-private.h, 1.9, 1.10 quota-storage.c, 1.9, 1.10 quota.c, 1.10, 1.11

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


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

Modified Files:
	quota-dirsize.c quota-private.h quota-storage.c quota.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: quota-dirsize.c
===================================================================
RCS file: /var/lib/cvs/dovecot/src/plugins/quota/quota-dirsize.c,v
retrieving revision 1.11
retrieving revision 1.12
diff -u -d -r1.11 -r1.12
--- quota-dirsize.c	11 Jun 2006 17:39:04 -0000	1.11
+++ quota-dirsize.c	28 Jun 2006 13:11:00 -0000	1.12
@@ -161,14 +161,15 @@
 	const char *path;
 	bool is_file;
 };
+ARRAY_DEFINE_TYPE(quota_count_path, struct quota_count_path);
 
-static void quota_count_path_add(array_t *paths, const char *path, bool is_file)
+static void quota_count_path_add(ARRAY_TYPE(quota_count_path) *paths,
+				 const char *path, bool is_file)
 {
-	ARRAY_SET_TYPE(paths, struct quota_count_path);
 	struct quota_count_path *count_path;
 	unsigned int i, count;
 
-	count_path = array_get_modifyable(paths, &count);
+	count_path = array_get_modifiable(paths, &count);
 	for (i = 0; i < count; i++) {
 		if (strncmp(count_path[i].path, path,
 			    strlen(count_path[i].path)) == 0) {
@@ -193,7 +194,7 @@
 get_quota_root_usage(struct dirsize_quota_root *root, uint64_t *value_r)
 {
 	struct mail_storage *const *storages;
-	array_t ARRAY_DEFINE(paths, struct quota_count_path);
+	ARRAY_TYPE(quota_count_path) paths;
 	const struct quota_count_path *count_paths;
 	unsigned int i, count;
 	const char *path;

Index: quota-private.h
===================================================================
RCS file: /var/lib/cvs/dovecot/src/plugins/quota/quota-private.h,v
retrieving revision 1.9
retrieving revision 1.10
diff -u -d -r1.9 -r1.10
--- quota-private.h	11 Jun 2006 17:39:04 -0000	1.9
+++ quota-private.h	28 Jun 2006 13:11:00 -0000	1.10
@@ -9,7 +9,7 @@
 extern unsigned int quota_module_id;
 
 struct quota {
-	array_t ARRAY_DEFINE(setups, struct quota_setup *);
+	ARRAY_DEFINE(setups, struct quota_setup *);
 	char *last_error;
 };
 
@@ -20,7 +20,7 @@
 	char *data;
 
 	/* List of quota roots. It's array because there shouldn't be many. */
-	array_t ARRAY_DEFINE(roots, struct quota_root *);
+	ARRAY_DEFINE(roots, struct quota_root *);
 
 	unsigned int user_root:1;
 };
@@ -73,9 +73,9 @@
 	struct quota_backend_vfuncs v;
 
 	/* Mail storages using this quota root. */
-	array_t ARRAY_DEFINE(storages, struct mail_storage *);
+	ARRAY_DEFINE(storages, struct mail_storage *);
 	/* Module-specific contexts. See quota_module_id. */
-	array_t ARRAY_DEFINE(quota_module_contexts, void);
+	ARRAY_DEFINE(quota_module_contexts, void);
 
 	unsigned int user_root:1;
 };
@@ -88,8 +88,8 @@
 struct quota_transaction_context {
 	struct quota *quota;
 
-	array_t ARRAY_DEFINE(root_transactions,
-			     struct quota_root_transaction_context *);
+	ARRAY_DEFINE(root_transactions,
+		     struct quota_root_transaction_context *);
 	struct mail *mail;
 };
 

Index: quota-storage.c
===================================================================
RCS file: /var/lib/cvs/dovecot/src/plugins/quota/quota-storage.c,v
retrieving revision 1.9
retrieving revision 1.10
diff -u -d -r1.9 -r1.10
--- quota-storage.c	11 Jun 2006 17:39:04 -0000	1.9
+++ quota-storage.c	28 Jun 2006 13:11:00 -0000	1.10
@@ -11,7 +11,7 @@
 #include <sys/stat.h>
 
 #define QUOTA_CONTEXT(obj) \
-	*((void **)array_idx_modifyable(&(obj)->module_contexts, \
+	*((void **)array_idx_modifiable(&(obj)->module_contexts, \
 					quota_storage_module_id))
 
 struct quota_mail_storage {
@@ -19,7 +19,7 @@
 	struct quota *quota;
 
 	/* List of quota roots this storage belongs to. */
-	array_t ARRAY_DEFINE(roots, struct quota_root *);
+	ARRAY_DEFINE(roots, struct quota_root *);
 };
 
 struct quota_mailbox {

Index: quota.c
===================================================================
RCS file: /var/lib/cvs/dovecot/src/plugins/quota/quota.c,v
retrieving revision 1.10
retrieving revision 1.11
diff -u -d -r1.10 -r1.11
--- quota.c	16 Jun 2006 09:20:58 -0000	1.10
+++ quota.c	28 Jun 2006 13:11:00 -0000	1.11
@@ -131,7 +131,7 @@
 void quota_root_deinit(struct quota_root *root)
 {
 	/* make a copy, since root is freed */
-	array_t module_contexts = root->quota_module_contexts;
+	struct array module_contexts = root->quota_module_contexts.arr;
 	struct mail_storage *const *storage_p;
 	struct quota_root *const *roots;
 	unsigned int i, count;
@@ -154,7 +154,7 @@
 
 	array_free(&root->storages);
 	root->v.deinit(root);
-	array_free(&module_contexts);
+	_array_free(&module_contexts);
 }
 
 void quota_add_user_storage(struct quota *quota, struct mail_storage *storage)



More information about the dovecot-cvs mailing list