]> git.ipfire.org Git - thirdparty/dovecot/core.git/commitdiff
lib: Replace compile time defined conditions with COMPILE_ERROR_IF_TRUE.
authorsergey.kitov <sergey.kitov@open-xchange.com>
Mon, 3 Jan 2022 15:12:43 +0000 (17:12 +0200)
committeraki.tuomi <aki.tuomi@open-xchange.com>
Wed, 19 Jan 2022 11:06:38 +0000 (11:06 +0000)
src/lib/mempool-allocfree.c
src/lib/mempool-alloconly.c

index 07b74a89a0b14c2bd1db451da376e718d6911c36..3bbc642ae538fc1879c0b153e861c205871fe774 100644 (file)
@@ -147,8 +147,8 @@ pool_t pool_allocfree_create(const char *name ATTR_UNUSED)
 {
        struct allocfree_pool *pool;
 
-       if (SIZEOF_POOLBLOCK > (SSIZE_T_MAX - POOL_MAX_ALLOC_SIZE))
-               i_panic("POOL_MAX_ALLOC_SIZE is too large");
+       (void) COMPILE_ERROR_IF_TRUE(SIZEOF_POOLBLOCK >
+                                    (SSIZE_T_MAX - POOL_MAX_ALLOC_SIZE));
 
        pool = calloc(1, SIZEOF_ALLOCFREE_POOL);
        if (pool == NULL)
index 26f3360a4be040be8636be49cc9cdf5d3aff60bd..80c9a6b1caf0a9452944d4e001999eca146811f5 100644 (file)
@@ -231,8 +231,8 @@ pool_t pool_alloconly_create(const char *name ATTR_UNUSED, size_t size)
        size_t min_alloc = SIZEOF_POOLBLOCK +
                MEM_ALIGN(sizeof(struct alloconly_pool) + SENTRY_COUNT);
 
-       if (POOL_ALLOCONLY_MAX_EXTRA > (SSIZE_T_MAX - POOL_MAX_ALLOC_SIZE))
-               i_panic("POOL_MAX_ALLOC_SIZE is too large");
+       (void) COMPILE_ERROR_IF_TRUE(POOL_ALLOCONLY_MAX_EXTRA >
+                                    (SSIZE_T_MAX - POOL_MAX_ALLOC_SIZE));
 
 #ifdef DEBUG
        min_alloc += MEM_ALIGN(strlen(name) + 1 + SENTRY_COUNT) +