[FFmpeg-devel] [PATCH] Use posix_memalign() instead of memalign()
Diego Biurrun
diego
Fri Dec 19 11:18:04 CET 2008
On Thu, Dec 18, 2008 at 11:04:50PM -0200, Ramiro Polla wrote:
>
> On Tue, Oct 7, 2008 at 3:25 PM, M?ns Rullg?rd <mans at mansr.com> wrote:
> > "Ramiro Polla" <ramiro.polla at gmail.com> writes:
> >
> >> On Tue, Oct 7, 2008 at 4:24 AM, M?ns Rullg?rd <mans at mansr.com> wrote:
> >>> "Ramiro Polla" <ramiro.polla at gmail.com> writes:
> >>>
> >>>> On Sun, Sep 28, 2008 at 10:17 AM, M?ns Rullg?rd <mans at mansr.com> wrote:
> >>>>> 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...
> >>>>
> >>>> --- libavutil/mem.c (revision 15575)
> >>>> +++ libavutil/mem.c (working copy)
> >>>> @@ -57,8 +61,9 @@
> >>>> -#elif defined (HAVE_MEMALIGN)
> >>>> - ptr = memalign(16,size);
> >>>> +#elif defined (HAVE_POSIX_MEMALIGN)
> >>>> + if(posix_memalign(&ptr,16,size))
> >>>> + ptr = NULL;
> >>>
> >>> It might make sense to use memalign() as a fall-back for old BSD
> >>> systems and the like without posix_memalign().
> >>
> >> Would that be a manually entered list like is done for need_memalign?
> >
> > No, it would be tested by configure.
>
> New patch attached.
>
> --- 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?
Diego
More information about the ffmpeg-devel
mailing list