]> git.ipfire.org Git - thirdparty/dovecot/core.git/commitdiff
quota-dict: Remove T_BEGIN..T_END blocks
authorMartti Rannanjärvi <martti.rannanjarvi@dovecot.fi>
Mon, 16 Oct 2017 19:35:31 +0000 (22:35 +0300)
committerTimo Sirainen <tss@dovecot.fi>
Thu, 19 Oct 2017 13:43:44 +0000 (16:43 +0300)
This is to enable using t_strdup_printf() with error_r later on.

src/plugins/quota/quota-dict.c

index bec5e5f3b5f82ab9774f89426214e7114d3bfb71..262c04a904767a6b00c0bd3aa671e666b06d8763 100644 (file)
@@ -115,20 +115,18 @@ dict_quota_count(struct dict_quota_root *root,
        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: "
@@ -155,31 +153,29 @@ dict_quota_get_resource(struct quota_root *_root,
        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;
 }