apr-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Ivan Zhakov <i...@visualsvn.com>
Subject Re: svn commit: r1788334 - in /apr/apr/trunk: CHANGES include/apr_allocator.h memory/unix/apr_pools.c
Date Mon, 27 Mar 2017 13:55:16 GMT
On 24 March 2017 at 00:34,  <ylavic@apache.org> wrote:
> Author: ylavic
> Date: Thu Mar 23 21:34:25 2017
> New Revision: 1788334
>
> URL: http://svn.apache.org/viewvc?rev=1788334&view=rev
> Log:
> apr_allocator: Provide apr_allocator_align() to get the true size that
> would be allocated for the given size (including the header and alignment).
>
>
> Modified:
>     apr/apr/trunk/CHANGES
>     apr/apr/trunk/include/apr_allocator.h
>     apr/apr/trunk/memory/unix/apr_pools.c
>
> Modified: apr/apr/trunk/CHANGES
> URL: http://svn.apache.org/viewvc/apr/apr/trunk/CHANGES?rev=1788334&r1=1788333&r2=1788334&view=diff
> ==============================================================================
> --- apr/apr/trunk/CHANGES [utf-8] (original)
> +++ apr/apr/trunk/CHANGES [utf-8] Thu Mar 23 21:34:25 2017
> @@ -1,6 +1,10 @@
>                                                       -*- coding: utf-8 -*-
>  Changes for APR 2.0.0
>
> +  *) apr_allocator: Provide apr_allocator_align() to get the true size that
> +     would be allocated for the given size (including the header and
> +     alignment).  [Yann Ylavic]
> +
>    *) apr_crypto: avoid excessive iteration in bcrypt hash.
>       [Hanno Böck <hanno hboeck.de>]
>
>
> Modified: apr/apr/trunk/include/apr_allocator.h
> URL: http://svn.apache.org/viewvc/apr/apr/trunk/include/apr_allocator.h?rev=1788334&r1=1788333&r2=1788334&view=diff
> ==============================================================================
> --- apr/apr/trunk/include/apr_allocator.h (original)
> +++ apr/apr/trunk/include/apr_allocator.h Thu Mar 23 21:34:25 2017
> @@ -103,6 +103,14 @@ APR_DECLARE(apr_memnode_t *) apr_allocat
>  APR_DECLARE(void) apr_allocator_free(apr_allocator_t *allocator,
>                                       apr_memnode_t *memnode)
>                    __attribute__((nonnull(1,2)));
> +
> +/**
> + * Return the aligned (round up) size that an allocator would use for
> + * the given size.
> + * @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);
What is the purpose of this API? Currently caller may use
apr_memnode_t.endp to find actually allocated memory size.

Anyway I think it maybe worth to add apr_allocator_t argument to
apr_allocator_align() function even currently allocation alignment is
the same for all allocators.


-- 
Ivan Zhakov

Mime
View raw message