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

Michael Niedermayer michaelni
Wed Feb 13 18:35:25 CET 2008


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

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

Let us carefully observe those good qualities wherein our enemies excel us
and endeavor to excel them, by avoiding what is faulty, and imitating what
is excellent in them. -- Plutarch
-------------- 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/20080213/bd2e64f7/attachment.pgp>



More information about the ffmpeg-devel mailing list