[FFmpeg-devel] [PATCH] Use posix_memalign() instead of memalign()

Ramiro Polla ramiro.polla
Wed Jan 7 05:35:20 CET 2009


Hi,

On Fri, Dec 19, 2008 at 5:23 PM, Diego Biurrun <diego at biurrun.de> wrote:
> On Fri, Dec 19, 2008 at 08:41:41AM -0200, Ramiro Polla wrote:
>> >> --- libavutil/mem.c   (revision 16223)
>> >> +++ libavutil/mem.c   (working copy)
>> >> @@ -57,6 +58,9 @@
>> >> +#elif defined (HAVE_POSIX_MEMALIGN)
>> >> +    if(posix_memalign(&ptr,16,size))
>> >> +        ptr = NULL;
>> >>  #elif defined (HAVE_MEMALIGN)
>> >
>> > NULL?  Am I missing the obvious here?
>>
>> According to [0]:
>> Upon successful completion, posix_memalign() shall return zero;
>> otherwise, an error number shall be returned to indicate the error.
>>
>> So it fails on non-zero, and ptr would be uninitialized.
>>
>> I think
>>
>> +    ptr = NULL;
>> +    posix_memalign(&ptr,16,size);
>>
>> has the same effect and avoids an if.
>
> Yes, that would be more straightforward.

New patch attached.

Ramiro Polla
-------------- next part --------------
A non-text attachment was scrubbed...
Name: posix_memalign_x.diff
Type: text/x-diff
Size: 1694 bytes
Desc: not available
URL: <http://lists.mplayerhq.hu/pipermail/ffmpeg-devel/attachments/20090107/4b7b30b7/attachment.diff>



More information about the ffmpeg-devel mailing list