diff options
author | Aaron Crane <arc@cpan.org> | 2017-10-12 13:47:22 +0200 |
---|---|---|
committer | Aaron Crane <arc@cpan.org> | 2017-10-21 16:51:21 +0100 |
commit | 1c1d7d5ba0bc33e7bea0a9aeb2d420fc5a8128ab (patch) | |
tree | 74492a42f48126a77646de9420baebc6c28041bf /util.c | |
parent | 04322328fc4bc2863d0bc74339ed92d33b7eaba7 (diff) | |
download | perl-1c1d7d5ba0bc33e7bea0a9aeb2d420fc5a8128ab.tar.gz |
Don't look for a "safe" memcpy()
C89 says that, if you want to copy overlapping memory blocks, you must use
memmove(), and that attempt to copy overlapping memory blocks using memcpy()
yields undefined behaviour. So we should never even attempt to probe for a
system memcpy() implementation that just happens to handle overlapping
memory blocks. In particular, the compiler might compile the probe program
in such a way that Configure thinks overlapping memcpy() works even when it
doesn't.
This has the additional advantage of removing a Configure probe that needs
to execute a target-platform program on the build host.
Diffstat (limited to 'util.c')
-rw-r--r-- | util.c | 2 |
1 files changed, 1 insertions, 1 deletions
@@ -2225,7 +2225,7 @@ Perl_unlnk(pTHX_ const char *f) /* unlink all versions of a file */ /* this is a drop-in replacement for bcopy(), except for the return * value, which we need to be able to emulate memcpy() */ -#if !defined(HAS_MEMCPY) || (!defined(HAS_MEMMOVE) && !defined(HAS_SAFE_MEMCPY)) +#if !defined(HAS_MEMCPY) || !defined(HAS_MEMMOVE) void * Perl_my_bcopy(const void *vfrom, void *vto, size_t len) { |