[Ffmpeg-devel] [PATCH] avoid useless memcpy with src==dst (valgrind complains)

Reimar Döffinger Reimar.Doeffinger
Sun Jul 9 00:05:16 CEST 2006


Hello,
maybe this is cosmetics (not sure of the speed effects, but I doubt the
matter here), but I prefer to have less warnings with valgrind (this is
a memcpy here since buf and last point to structs).

Greetings,
Reimar D?ffinger
-------------- next part --------------
Index: libavcodec/utils.c
===================================================================
--- libavcodec/utils.c	(revision 5675)
+++ libavcodec/utils.c	(working copy)
@@ -375,9 +375,11 @@
     s->internal_buffer_count--;
     last = &((InternalBuffer*)s->internal_buffer)[s->internal_buffer_count];
 
+    if (buf != last) {
     temp= *buf;
     *buf= *last;
     *last= temp;
+    }
 
     for(i=0; i<3; i++){
         pic->data[i]=NULL;



More information about the ffmpeg-devel mailing list