"Ian Abbott" <[EMAIL PROTECTED]> writes:

> A memmove() replacement has already been added to Wget in CVS, but
> here is a patch to use bcopy() if available.

I was thinking about this for some time.  The reasons I chose to roll
in the memmove() from GNU libit rather than use bcopy are the
following:

* It seems that bcopy handles overlapping blocks on *some*
  architectures.  But searching the net showed that many people
  believe it not to be safe to rely on this for *all* architectures.

* Perl actually uses configure to check whether bcopy() handles
  overlaps.  Another vote for the statement that bcopy() can be
  overlap-unsafe.

  (But I would like to avoid doing that check in Wget because of
  cross-compiled builds and because I'm not sure there's a way to
  *prove* that bcopy works with overlapping blocks in a general way.)

* If we ever do encounter an architecture with overlap-unsafe bcopy,
  the bug will be very hard to detect because it will have been buried
  in a little-used area in Wget.  Still, it will be there and it might
  cause occasional and weird bugs.

* Wget can live with a less-than-fully optimized memmove.  The reason
  I wanted to use bcopy is not so much of speed, but simply because I
  *like* to reuse the existing library functionality.  But if such
  reuse carries a potential unsafety, it's just not worth it.

Reply via email to