apr-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Yann Ylavic <ylavic....@gmail.com>
Subject Re: svn commit: r1788467 - in /apr/apr-util/branches/1.6.x: ./ CHANGES buckets/apr_buckets_alloc.c buckets/apr_buckets_file.c include/apr_buckets.h
Date Sat, 25 Mar 2017 12:06:12 GMT
On Fri, Mar 24, 2017 at 4:13 PM,  <ylavic@apache.org> wrote:
> Author: ylavic
> Date: Fri Mar 24 15:13:16 2017
> New Revision: 1788467
>
> URL: http://svn.apache.org/viewvc?rev=1788467&view=rev
> Log:
> Merge r1788335 from trunk:
>
> apr_buckets: Add apr_bucket_file_set_buf_size() which allows to configure
> the size of the buffer used to read files.
>
> Modified:
>     apr/apr-util/branches/1.6.x/   (props changed)
>     apr/apr-util/branches/1.6.x/CHANGES
>     apr/apr-util/branches/1.6.x/buckets/apr_buckets_alloc.c
[]
> ==============================================================================
> --- apr/apr-util/branches/1.6.x/buckets/apr_buckets_alloc.c (original)
> +++ apr/apr-util/branches/1.6.x/buckets/apr_buckets_alloc.c Fri Mar 24 15:13:16 2017
> @@ -18,6 +18,7 @@
>
>  #include "apr_buckets.h"
>  #include "apr_allocator.h"
> +#include "apr_version.h"
>
>  #define ALLOC_AMT (8192 - APR_MEMNODE_T_SIZE)
>
> @@ -121,6 +122,35 @@ APU_DECLARE_NONSTD(void) apr_bucket_allo
>  #endif
>  }
>
> +APU_DECLARE_NONSTD(apr_size_t) apr_bucket_alloc_aligned_floor(apr_size_t size)
> +{
> +    if (size <= SMALL_NODE_SIZE) {
> +        size = SMALL_NODE_SIZE;
> +    }
> +    else {
> +#if APR_VERSION_AT_LEAST(1,6,0)
> +        if (size < APR_MEMNODE_T_SIZE) {
> +            size = apr_allocator_align(0);
> +        }
> +        else {
> +            size = apr_allocator_align(size - APR_MEMNODE_T_SIZE);
> +        }
> +#else
> +        /* Assumes the minimum (default) allocator's boundary of 4K and
> +         * minimum (immutable before APR-1.6.x) allocation size of 8K,
> +         * hence possibly (yet unlikely) under-estimating the floor...
> +         */
> +        size = APR_ALIGN(size, 4096);
> +        if (size < 8192) {
> +            size = 8192;
> +        }
> +#endif
> +        size -= APR_MEMNODE_T_SIZE;
> +    }
> +    size -= SIZEOF_NODE_HEADER_T;
> +    return size;
> +}

I don't see any other decisional on APR_VERSION in apr-util code, does
it mean that an apr-util major.minor is bound to the same apr's
major.minor (e.g. apr-util-1.6.x is necessarily
distributed/to-be-linked with apr-1.6.x)?

If this is the case the above code could assume that
apr_allocator_align() exists and avoid the current (unwise?)
assumption otherwise...

Thanks for some enlightenments.

Regards,
Yann.

Mime
View raw message