]> git.ipfire.org Git - thirdparty/dovecot/core.git/commitdiff
quota: quota-util - Simplify quota_is_over()
authorStephan Bosch <stephan.bosch@open-xchange.com>
Tue, 9 Nov 2021 22:56:55 +0000 (23:56 +0100)
committeraki.tuomi <aki.tuomi@open-xchange.com>
Wed, 26 Feb 2025 10:45:00 +0000 (10:45 +0000)
src/plugins/quota/quota-util.c

index 3ea95d7b49186303e96e38234d891603c5a14bb9..0e0738c610723cdcae1747b4d5482d35adb71ce0 100644 (file)
@@ -90,16 +90,12 @@ quota_is_over(uoff_t alloc, int64_t used, uint64_t ceil, uint64_t over)
                                return TRUE;
                        }
                }
-       } else if (alloc == 0) {
-               /* Nothing was allocated in this transaction. We need to
-                  explicitly test this case, since the generic check would fail
-                  if user is already over quota. */
+       } else {
+               /* Resource usage increased in this transaction. */
                if (over > 0) {
                        /* Resource usage is already over quota. */
                        return TRUE;
                }
-       } else {
-               /* Resource usage increased in this transaction. */
                if (ceil < alloc || (ceil - alloc) < (uint64_t)used) {
                        /* Limit reached. */
                        return TRUE;