if (quota_count(&root->root, &bytes, &count) < 0)
return -1;
- T_BEGIN {
- dt = dict_transaction_begin(root->dict);
- /* these unsets are mainly necessary for pgsql, because its
- trigger otherwise increases quota without deleting it.
- but some people with other databases want to store the
- quota usage among other data in the same row, which
- shouldn't be deleted. */
- if (!root->disable_unset) {
- dict_unset(dt, DICT_QUOTA_CURRENT_BYTES_PATH);
- dict_unset(dt, DICT_QUOTA_CURRENT_COUNT_PATH);
- }
- dict_set(dt, DICT_QUOTA_CURRENT_BYTES_PATH, dec2str(bytes));
- dict_set(dt, DICT_QUOTA_CURRENT_COUNT_PATH, dec2str(count));
- } T_END;
+ dt = dict_transaction_begin(root->dict);
+ /* these unsets are mainly necessary for pgsql, because its
+ trigger otherwise increases quota without deleting it.
+ but some people with other databases want to store the
+ quota usage among other data in the same row, which
+ shouldn't be deleted. */
+ if (!root->disable_unset) {
+ dict_unset(dt, DICT_QUOTA_CURRENT_BYTES_PATH);
+ dict_unset(dt, DICT_QUOTA_CURRENT_COUNT_PATH);
+ }
+ dict_set(dt, DICT_QUOTA_CURRENT_BYTES_PATH, dec2str(bytes));
+ dict_set(dt, DICT_QUOTA_CURRENT_COUNT_PATH, dec2str(count));
if (root->root.quota->set->debug) {
i_debug("dict quota: Quota recalculated: "
else
return 0;
- T_BEGIN {
- const char *key, *value, *error;
-
- key = want_bytes ? DICT_QUOTA_CURRENT_BYTES_PATH :
- DICT_QUOTA_CURRENT_COUNT_PATH;
- ret = dict_lookup(root->dict, unsafe_data_stack_pool,
- key, &value, &error);
- if (ret < 0) {
- i_error("dict quota: dict_lookup(%s) failed: %s", key, error);
- *value_r = 0;
- } else {
- intmax_t tmp;
-
- /* recalculate quota if it's negative or if it
- wasn't found */
- if (ret == 0 || str_to_intmax(value, &tmp) < 0)
- tmp = -1;
- if (tmp >= 0)
- *value_r = tmp;
- else {
- ret = dict_quota_count(root, want_bytes,
- value_r);
- }
+ const char *key, *value, *error;
+
+ key = want_bytes ? DICT_QUOTA_CURRENT_BYTES_PATH :
+ DICT_QUOTA_CURRENT_COUNT_PATH;
+ ret = dict_lookup(root->dict, unsafe_data_stack_pool,
+ key, &value, &error);
+ if (ret < 0) {
+ i_error("dict quota: dict_lookup(%s) failed: %s", key, error);
+ *value_r = 0;
+ } else {
+ intmax_t tmp;
+
+ /* recalculate quota if it's negative or if it
+ wasn't found */
+ if (ret == 0 || str_to_intmax(value, &tmp) < 0)
+ tmp = -1;
+ if (tmp >= 0)
+ *value_r = tmp;
+ else {
+ ret = dict_quota_count(root, want_bytes,
+ value_r);
}
- } T_END;
+ }
return ret;
}