[FFmpeg-devel] [PATCH] utils.c: avoid FFSWAP of identical buffers

Jindrich Makovicka makovick
Wed Nov 12 16:18:05 CET 2008

On Mon, Nov 10, 2008 at 15:31, M?ns Rullg?rd <mans at mansr.com> wrote:
> Jindrich Makovicka wrote:
>> Hi,
>> the attached patch skips doing FFSWAP() if the buffers are actually
>> the same, to avoid useless copying and to suppress a "memcpy() with
>> overlapping src and dest" warning in Valgrind.
> While avoiding useless copying is of course good, the cause of the valgrind
> warning is a gcc bug.  Unless the compiler can prove that the source and
> destination do not overlap, it must not issue a memcpy() call to effect a
> struct assignment.  The C standard specifically allows assignment with
> source equal to destination, whereas memcpy() does not.

Right, I recall some flames about this here or on the MPlayer list.

Do you find this change justifiable by the former reason?

Jindrich Makovicka

More information about the ffmpeg-devel mailing list