Re: [PATCH] Reimplement aligned_alloc

Corinna Vinschen via Newlib <[email protected]>
Newsgroups gmane.comp.lib.newlib
Message-ID <[email protected]>
On May 19 10:52, Szabolcs Nagy wrote:
> The original implementation had multiple issues:
> 
> - Only worked when posix_memalign was available (Linux, RTEMS).
> - Violated C11 link namespace rules by calling posix_memalign.
> - Failed to set errno on error.
> 
> These can be fixed by essentially using the same implementation
> for aligned_alloc as for memalign, i.e. simply calling _memalign_r
> (which is always available and a "more reserved name" although
> technically still not in the reserved link namespace, at least
> code written in c cannot define a colliding symbol, newlib has
> plenty such namespace issues so this is fine).
> 
> It is not clear what the right policy is when MALLOC_PROVIDED is set,
> currently that does not cover aligned_alloc so it is kept that way.
> 
> Tested on aarch64-none-elf
> ---
>  newlib/libc/stdlib/aligned_alloc.c | 62 +++++++++++++++---------------
>  1 file changed, 30 insertions(+), 32 deletions(-)

Pushed.


Thanks,
Corinna

-- 
Corinna Vinschen
Cygwin Maintainer
Red Hat
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.