unsigned char *new_mem;
struct pool_block *block = pool_block_detach(apool, mem);
+ if (old_size == SIZE_MAX)
+ old_size = block->size;
if ((new_mem = realloc(block, SIZEOF_POOLBLOCK+new_size)) == NULL)
i_fatal_status(FATAL_OUTOFMEM, "realloc(block, %zu)",
SIZEOF_POOLBLOCK+new_size);
container_of(pool, struct alloconly_pool, pool);
unsigned char *new_mem;
+ i_assert(old_size < SIZE_MAX);
+
if (new_size <= old_size)
return mem;
container_of(pool, struct datastack_pool, pool);
void *new_mem;
+ i_assert(old_size < SIZE_MAX);
+
/* @UNSAFE */
if (unlikely(dpool->data_stack_frame != data_stack_frame_id))
i_panic("pool_data_stack_realloc(): stack frame changed");
{
void *new_mem;
+ i_assert(old_size < SIZE_MAX);
+
/* @UNSAFE */
if (old_size >= new_size)
return mem;
return pool->v->malloc(pool, size);
}
+/* For allocfree and system pools you can use SIZE_MAX
+ to indicate that you have no knowlege of the old size. */
static inline void * ATTR_WARN_UNUSED_RESULT ATTR_RETURNS_NONNULL
p_realloc(pool_t pool, void *mem, size_t old_size, size_t new_size)
{