[dovecot-cvs] dovecot/src/plugins/quota quota-dict.c,1.2,1.3

cras at dovecot.org cras at dovecot.org
Sat Dec 31 00:09:06 EET 2005


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

Modified Files:
	quota-dict.c 
Log Message:
Added dictinary lookup server and a "proxy" dict implementation to talk to
it.



Index: quota-dict.c
===================================================================
RCS file: /var/lib/cvs/dovecot/src/plugins/quota/quota-dict.c,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -d -r1.2 -r1.3
--- quota-dict.c	28 Dec 2005 20:17:51 -0000	1.2
+++ quota-dict.c	30 Dec 2005 22:09:04 -0000	1.3
@@ -131,22 +131,24 @@
 {
 	struct dict_quota *quota = (struct dict_quota *)root->quota;
 	const char *value;
+	int ret;
 
 	if (quota->dict == NULL)
 		return 0;
 
 	t_push();
-	value = dict_lookup(quota->dict, unsafe_data_stack_pool,
-			    t_strconcat(DICT_QUOTA_LIMIT_PATH, name, NULL));
+	ret = dict_lookup(quota->dict, unsafe_data_stack_pool,
+			  t_strconcat(DICT_QUOTA_LIMIT_PATH, name, NULL),
+			  &value);
 	*limit_r = value == NULL ? 0 : strtoull(value, NULL, 10);
 
 	if (value == NULL) {
 		/* resource doesn't exist */
 		*value_r = 0;
 	} else {
-		value = dict_lookup(quota->dict, unsafe_data_stack_pool,
-				    t_strconcat(DICT_QUOTA_CURRENT_PATH,
-						name, NULL));
+		ret = dict_lookup(quota->dict, unsafe_data_stack_pool,
+				  t_strconcat(DICT_QUOTA_CURRENT_PATH,
+					      name, NULL), &value);
 		*value_r = value == NULL ? 0 : strtoull(value, NULL, 10);
 	}
 	t_pop();
@@ -154,7 +156,7 @@
 	*limit_r /= 1024;
 	*value_r /= 1024;
 
-	return value == NULL;
+	return ret;
 }
 
 static int
@@ -180,13 +182,13 @@
 
 	if (quota->dict != NULL) {
 		t_push();
-		value = dict_lookup(quota->dict, unsafe_data_stack_pool,
-				    DICT_QUOTA_LIMIT_PATH"storage");
+		(void)dict_lookup(quota->dict, unsafe_data_stack_pool,
+				  DICT_QUOTA_LIMIT_PATH"storage", &value);
 		ctx->storage_limit = value == NULL ? 0 :
 			strtoull(value, NULL, 10);
 
-		value = dict_lookup(quota->dict, unsafe_data_stack_pool,
-				    DICT_QUOTA_CURRENT_PATH"storage");
+		(void)dict_lookup(quota->dict, unsafe_data_stack_pool,
+				  DICT_QUOTA_CURRENT_PATH"storage", &value);
 		ctx->storage_current = value == NULL ? 0 :
 			strtoull(value, NULL, 10);
 		t_pop();



More information about the dovecot-cvs mailing list