[FFmpeg-devel] Patch: avoid "void * " in pointer calculate

Michael Niedermayer michaelni
Thu Feb 14 03:02:27 CET 2008


On Thu, Feb 14, 2008 at 09:01:08AM +0800, mvplayer wrote:
> On Feb 14, 2008 1:35 AM, Michael Niedermayer <michaelni at gmx.at> wrote:
> 
> > On Wed, Feb 13, 2008 at 09:29:46PM +0800, mvplayer wrote:
> > > As $subject
> > [...]
> > > -void *av_realloc(void *ptr, unsigned int size)
> > > +void *av_realloc(void *ptr1, unsigned int size)
> > >  {
> > >  #ifdef CONFIG_MEMALIGN_HACK
> > >      int diff;
> > > +    char *ptr = ptr1;
> > >  #endif
> > >
> > >      /* let's disallow possible ambiguous cases */
> > > @@ -105,9 +106,9 @@
> > >      //FIXME this isn't aligned correctly, though it probably isn't
> > needed
> > >      if(!ptr) return av_malloc(size);
> > >      diff= ((char*)ptr)[-1];
> > > -    return realloc(ptr - diff, size + diff) + diff;
> > > +    return (char*)realloc(ptr - diff, size + diff) + diff;
> > >  #else
> > > -    return realloc(ptr, size);
> > > +    return realloc(ptr1, size);
> > >  #endif
> >
> > this can be done simpler, i dont see why you would need an extra var
> >
> > Sure!
> 
> a clean version arrived!

looks ok

[...]
-- 
Michael     GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB

it is not once nor twice but times without number that the same ideas make
their appearance in the world. -- Aristotle
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: Digital signature
URL: <http://lists.mplayerhq.hu/pipermail/ffmpeg-devel/attachments/20080214/7e785296/attachment.pgp>



More information about the ffmpeg-devel mailing list