[FFmpeg-devel] [PATCH] avutil/mem: use C11 aligned_malloc()

James Almer jamrial at gmail.com
Mon Feb 19 03:37:41 EET 2024


On 2/18/2024 9:08 PM, Michael Niedermayer wrote:
> On Sun, Feb 18, 2024 at 01:16:36PM -0300, James Almer wrote:
>> Save for the Microsoft C Runtime library, where free() can't handle aligned
>> buffers, aligned_malloc() should be available and working on all supported
>> targets.
>> Also, malloc() alone may be sufficient if alignment requirement is low, so add
>> a check for it.
>>
>> Signed-off-by: James Almer <jamrial at gmail.com>
>> ---
>>   configure       |  2 --
>>   libavutil/mem.c | 42 ++++++------------------------------------
>>   2 files changed, 6 insertions(+), 38 deletions(-)
> 
> This breaks build here
> 
> libavutil/mem.c: In function ‘av_malloc’:
> libavutil/mem.c:108:15: error: implicit declaration of function ‘aligned_malloc’; did you mean ‘aligned_alloc’? [-Werror=implicit-function-declaration]
>           ptr = aligned_malloc(size, ALIGN);
>                 ^~~~~~~~~~~~~~
>                 aligned_alloc
> libavutil/mem.c:108:13: warning: assignment makes pointer from integer without a cast [-Wint-conversion]
>           ptr = aligned_malloc(size, ALIGN);
>               ^
> cc1: some warnings being treated as errors
> ffbuild/common.mak:81: recipe for target 'libavutil/mem.o' failed

Yes, i mistyped aligned_alloc as aligned_malloc.


More information about the ffmpeg-devel mailing list