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

Michael Niedermayer michael at niedermayer.cc
Mon Feb 19 02:08:18 EET 2024


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

[...]
-- 
Michael     GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB

Dictatorship naturally arises out of democracy, and the most aggravated
form of tyranny and slavery out of the most extreme liberty. -- Plato
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 195 bytes
Desc: not available
URL: <https://ffmpeg.org/pipermail/ffmpeg-devel/attachments/20240219/2910974e/attachment.sig>


More information about the ffmpeg-devel mailing list