From: Martti Rannanjärvi Date: Wed, 20 Sep 2017 09:32:40 +0000 (+0300) Subject: quota-clone: Rename ret_bytes and ret_count to bytes_res and count_res X-Git-Tag: 2.3.0.rc1~487 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=bb11a1957aefbd2a2edf7ae25af4032899c34c41;p=thirdparty%2Fdovecot%2Fcore.git quota-clone: Rename ret_bytes and ret_count to bytes_res and count_res This is because the variables do not contain the actual quota resource values but whether the lookup was successful. --- diff --git a/src/plugins/quota-clone/quota-clone-plugin.c b/src/plugins/quota-clone/quota-clone-plugin.c index ed204f2390..00eb7d7994 100644 --- a/src/plugins/quota-clone/quota-clone-plugin.c +++ b/src/plugins/quota-clone/quota-clone-plugin.c @@ -48,7 +48,7 @@ static void quota_clone_flush_real(struct mailbox *box) struct quota_root *root; uint64_t bytes_value, count_value, limit; const char *error; - enum quota_get_result ret_bytes, ret_count; + enum quota_get_result bytes_res, count_res; /* we'll clone the first quota root */ iter = quota_root_iter_init(box); @@ -61,40 +61,41 @@ static void quota_clone_flush_real(struct mailbox *box) } /* get new values first */ - ret_bytes = quota_get_resource(root, "", QUOTA_NAME_STORAGE_BYTES, + bytes_res = quota_get_resource(root, "", QUOTA_NAME_STORAGE_BYTES, &bytes_value, &limit, &error); - if (ret_bytes == QUOTA_GET_RESULT_INTERNAL_ERROR) { + if (bytes_res == QUOTA_GET_RESULT_INTERNAL_ERROR) { i_error("quota_clone_plugin: " "Failed to get quota resource "QUOTA_NAME_STORAGE_BYTES": %s", error); return; } - ret_count = quota_get_resource(root, "", QUOTA_NAME_MESSAGES, + count_res = quota_get_resource(root, "", QUOTA_NAME_MESSAGES, &count_value, &limit, &error); - if (ret_count == QUOTA_GET_RESULT_INTERNAL_ERROR) { + if (count_res == QUOTA_GET_RESULT_INTERNAL_ERROR) { i_error("quota_clone_plugin: " "Failed to get quota resource "QUOTA_NAME_MESSAGES": %s", error); return; } - if (ret_bytes == QUOTA_GET_RESULT_UNKNOWN_RESOURCE && - ret_count == QUOTA_GET_RESULT_UNKNOWN_RESOURCE) { + if (bytes_res == QUOTA_GET_RESULT_UNKNOWN_RESOURCE && + count_res == QUOTA_GET_RESULT_UNKNOWN_RESOURCE) { /* quota resources don't exist - no point in updating it */ return; } - /* Then update the resources that exist. The resources can't really + /* Then update the resources that exist. The resources' existence can't change unless the quota backend is changed, so we don't worry about - the special case of ret_count changing between 1 and 0. Note that - ret_count==1 also when quota is unlimited. */ + the special case of lookup changing from + RESULT_LIMITED/RESULT_UNLIMITED to RESULT_UNKNOWN_RESOURCE, which + leaves the old value unchanged. */ trans = dict_transaction_begin(quser->dict); - if (ret_bytes == QUOTA_GET_RESULT_LIMITED || - ret_bytes == QUOTA_GET_RESULT_UNLIMITED) { + if (bytes_res == QUOTA_GET_RESULT_LIMITED || + bytes_res == QUOTA_GET_RESULT_UNLIMITED) { dict_set(trans, DICT_QUOTA_CLONE_BYTES_PATH, t_strdup_printf("%"PRIu64, bytes_value)); } - if (ret_count == QUOTA_GET_RESULT_LIMITED || - ret_count == QUOTA_GET_RESULT_UNLIMITED) { + if (count_res == QUOTA_GET_RESULT_LIMITED || + count_res == QUOTA_GET_RESULT_UNLIMITED) { dict_set(trans, DICT_QUOTA_CLONE_COUNT_PATH, t_strdup_printf("%"PRIu64, count_value)); }