[FFmpeg-devel] [PATCH] [RFC] libavutil/mem.c: Check return value of posix_memalign
Patrik Kullman
patrik
Fri Feb 13 16:20:56 CET 2009
On Fri, 2009-02-13 at 15:18 +0000, M?ns Rullg?rd wrote:
> Patrik Kullman <patrik at yes.nu> writes:
>
> > In my hunt to fix compilation warnings for ffmpeg, learn ffmpeg
> > internals and learn C, I've come up with the patch to get rid of the
> > "warn_unused_result" warning for mem.c
> >
> > Possibly horribly wrong ;)
> >
> > Index: libavutil/mem.c
> > ===================================================================
> > --- libavutil/mem.c (revision 17209)
> > +++ libavutil/mem.c (working copy)
> > @@ -63,7 +63,12 @@
> > ptr = (char*)ptr + diff;
> > ((char*)ptr)[-1]= diff;
> > #elif HAVE_POSIX_MEMALIGN
> > - posix_memalign(&ptr,16,size);
> > + if (posix_memalign(&ptr,16,size) != 0)
> > +#if HAVE_MEMALIGN
> > + ptr = memalign(16,size);
> > +#else
> > + ptr = malloc(size);
> > +#endif
> > #elif HAVE_MEMALIGN
> > ptr = memalign(16,size);
> > /* Why 64?
>
> What is the warning?
libavutil/mem.c: In function ?av_malloc?:
libavutil/mem.c:66: warning: ignoring return value of ?posix_memalign?,
declared with attribute warn_unused_result
More information about the ffmpeg-devel
mailing list