about summary refs log tree commit diff
path: root/src/malloc/aligned_alloc.c
Commit message (Collapse)AuthorAgeFilesLines
* move oldmalloc to its own directory under src/mallocRich Felker2020-06-031-52/+0
| | | | | | | | | | | | | this sets the stage for replacement, and makes it practical to keep oldmalloc around as a build option for a while if that ends up being useful. only the files which are actually part of the implementation are moved. memalign and posix_memalign are entirely generic. in theory calloc could be pulled out too, but it's useful to have it tied to the implementation so as to optimize out unnecessary memset when implementation details make it possible to know the memory is already clear.
* rename aligned_alloc source file back to its proper nameRich Felker2020-06-031-0/+52
|
* rename aligned_alloc source fileRich Felker2020-06-031-7/+0
| | | | | this is the first step of swapping the name of the actual implementation to aligned_alloc while preserving history follow.
* move __memalign declaration to malloc_impl.hRich Felker2018-09-121-2/+1
| | | | | | | | the malloc-implementation-private header is the only right place for this, because, being in the reserved namespace, __memalign is not interposable and thus not valid to use anywhere else. anything outside of the malloc implementation must call an appropriate-namespace public function (aligned_alloc or posix_memalign).
* move core memalign code from aligned_alloc to __memalignRich Felker2013-07-041-46/+2
| | | | | | | | | | | | there are two motivations for this change. one is to avoid gratuitously depending on a C11 symbol for implementing a POSIX function. the other pertains to the documented semantics. C11 does not define any behavior for aligned_alloc when the length argument is not a multiple of the alignment argument. posix_memalign on the other hand places no requirements on the length argument. using __memalign as the implementation of both, rather than trying to implement one in terms of the other when their documented contracts differ, eliminates this confusion.
* move alignment check from aligned_alloc to posix_memalignRich Felker2013-07-041-1/+1
| | | | | | | | C11 has no requirement that the alignment be a multiple of sizeof(void*), and in fact seems to require any "valid alignment supported by the implementation" to work. since the alignment of char is 1 and thus a valid alignment, an alignment argument of 1 should be accepted.
* fix invalid read in aligned_allocRich Felker2012-12-061-2/+3
| | | | | | in case of mmap-obtained chunks, end points past the end of the mapping and reading it may fault. since the value is not needed until after the conditional, move the access to prevent invalid reads.
* implement "low hanging fruit" from C11Rich Felker2012-08-251-0/+51
based on Gregor's patch sent to the list. includes: - stdalign.h - removing gets in C11 mode - adding aligned_alloc and adjusting other functions to use it - adding 'x' flag to fopen for exclusive mode