[FFmpeg-devel] [PATCH] Use posix_memalign() instead of memalign() (Was: [PATCH 4/4] Include stdlib.h to avoid an implicit declaration on OpenSolaris.)

Ramiro Polla ramiro.polla
Tue Oct 7 03:10:56 CEST 2008


Hi,

On Sun, Sep 28, 2008 at 10:17 AM, M?ns Rullg?rd <mans at mansr.com> wrote:
> Diego 'Flameeyes' Petten? <flameeyes at gmail.com> writes:
>
>> While on GLIBC the memalign() function is declared in malloc.h, on
>> OpenSolaris its definiton is in stdlib.h; include the file so that an
>> implicit declaration can be avoided.
>> ---
>>
>>  libavutil/mem.c |    1 +
>>  1 files changed, 1 insertions(+), 0 deletions(-)
>>
>> diff --git a/libavutil/mem.c b/libavutil/mem.c
>> index 960074c..da75638 100644
>> --- a/libavutil/mem.c
>> +++ b/libavutil/mem.c
>> @@ -34,6 +34,7 @@
>>  #ifdef HAVE_MALLOC_H
>>  #include <malloc.h>
>>  #endif
>> +#include <stdlib.h>
>>
>>  /* you can redefine av_malloc and av_free in your project to use your
>>     memory allocator. You do not need to suppress this file because the
>
> #including stdlib.h obviously can't do any harm, it being a standard
> header.

> There is, however, a deeper issue here: memalign() is not
> defined by any standard, and some systems that have it provide no
> means to free such allocations.  Is there any reason we can't use the
> standard posix_memalign() instead?

Attached patch should spark some discussion...

Ramiro Polla
-------------- next part --------------
A non-text attachment was scrubbed...
Name: posix_memalign.diff
Type: text/x-diff
Size: 1827 bytes
Desc: not available
URL: <http://lists.mplayerhq.hu/pipermail/ffmpeg-devel/attachments/20081006/be7ec017/attachment.diff>



More information about the ffmpeg-devel mailing list