[FFmpeg-devel] [PATCH] Use posix_memalign() instead of memalign()
Ramiro Polla
ramiro.polla
Thu Jan 8 00:36:49 CET 2009
On Wed, Jan 7, 2009 at 7:32 AM, M?ns Rullg?rd <mans at mansr.com> wrote:
> "Ramiro Polla" <ramiro.polla at gmail.com> writes:
>
>> 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.
>
> Looks OK to me.
Applied.
More information about the ffmpeg-devel
mailing list