summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--buckets/apr_buckets_alloc.c8
-rw-r--r--buckets/apr_buckets_file.c2
-rw-r--r--include/apr_allocator.h4
-rw-r--r--include/apr_buckets.h5
-rw-r--r--memory/unix/apr_pools.c4
5 files changed, 16 insertions, 7 deletions
diff --git a/buckets/apr_buckets_alloc.c b/buckets/apr_buckets_alloc.c
index 833621c4a..79ac9293e 100644
--- a/buckets/apr_buckets_alloc.c
+++ b/buckets/apr_buckets_alloc.c
@@ -123,17 +123,19 @@ APR_DECLARE_NONSTD(void) apr_bucket_alloc_destroy(apr_bucket_alloc_t *list)
#endif
}
-APR_DECLARE_NONSTD(apr_size_t) apr_bucket_alloc_aligned_floor(apr_size_t size)
+APR_DECLARE_NONSTD(apr_size_t) apr_bucket_alloc_aligned_floor(apr_bucket_alloc_t *list,
+ apr_size_t size)
{
if (size <= SMALL_NODE_SIZE) {
size = SMALL_NODE_SIZE;
}
else {
if (size < APR_MEMNODE_T_SIZE) {
- size = apr_allocator_align(0);
+ size = apr_allocator_align(list->allocator, 0);
}
else {
- size = apr_allocator_align(size - APR_MEMNODE_T_SIZE);
+ size = apr_allocator_align(list->allocator,
+ size - APR_MEMNODE_T_SIZE);
}
size -= APR_MEMNODE_T_SIZE;
}
diff --git a/buckets/apr_buckets_file.c b/buckets/apr_buckets_file.c
index 7cea3a40d..82bb2d172 100644
--- a/buckets/apr_buckets_file.c
+++ b/buckets/apr_buckets_file.c
@@ -205,7 +205,7 @@ APR_DECLARE(apr_status_t) apr_bucket_file_set_buf_size(apr_bucket *e,
a->read_size = APR_BUCKET_BUFF_SIZE;
}
else {
- apr_size_t floor = apr_bucket_alloc_aligned_floor(size);
+ apr_size_t floor = apr_bucket_alloc_aligned_floor(e->list, size);
a->read_size = (size < floor) ? size : floor;
}
diff --git a/include/apr_allocator.h b/include/apr_allocator.h
index 32cffd7f4..4d9d76220 100644
--- a/include/apr_allocator.h
+++ b/include/apr_allocator.h
@@ -122,10 +122,12 @@ APR_DECLARE(apr_status_t) apr_allocator_min_order_set(unsigned int order);
/**
* Get the true size that would be allocated for the given size (including
* the header and alignment).
+ * @param list The allocator from which to the memory would be allocated
* @param size The size to align
* @return The aligned size (or zero on apr_size_t overflow)
*/
-APR_DECLARE(apr_size_t) apr_allocator_align(apr_size_t size);
+APR_DECLARE(apr_size_t) apr_allocator_align(apr_allocator_t *allocator,
+ apr_size_t size);
#include "apr_pools.h"
diff --git a/include/apr_buckets.h b/include/apr_buckets.h
index ba1762efc..abecd16ef 100644
--- a/include/apr_buckets.h
+++ b/include/apr_buckets.h
@@ -997,10 +997,13 @@ APR_DECLARE_NONSTD(void) apr_bucket_alloc_destroy(apr_bucket_alloc_t *list)
* Get the aligned size corresponding to the requested size, but minus the
* allocator(s) overhead such that the allocation would remain in the
* same boundary.
+ * @param list The allocator from which to the memory would be allocated.
* @param size The requested size.
* @return The corresponding aligned/floored size.
*/
-APR_DECLARE_NONSTD(apr_size_t) apr_bucket_alloc_aligned_floor(apr_size_t size);
+APR_DECLARE_NONSTD(apr_size_t) apr_bucket_alloc_aligned_floor(apr_bucket_alloc_t *list,
+ apr_size_t size)
+ __attribute__((nonnull(1)));
/**
* Allocate memory for use by the buckets.
diff --git a/memory/unix/apr_pools.c b/memory/unix/apr_pools.c
index e3d82d0f7..d2ff53dcd 100644
--- a/memory/unix/apr_pools.c
+++ b/memory/unix/apr_pools.c
@@ -260,8 +260,10 @@ apr_size_t allocator_align(apr_size_t in_size)
return size;
}
-APR_DECLARE(apr_size_t) apr_allocator_align(apr_size_t size)
+APR_DECLARE(apr_size_t) apr_allocator_align(apr_allocator_t *allocator,
+ apr_size_t size)
{
+ (void)allocator;
return allocator_align(size);
}