[FFmpeg-devel] [PATCH] utils.c: avoid FFSWAP of identical buffers
Måns Rullgård
mans
Mon Nov 10 15:31:33 CET 2008
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.
--
M?ns Rullg?rd
mans at mansr.com
More information about the ffmpeg-devel
mailing list