[OpenAFS-devel] strings redux

Russ Allbery rra@stanford.edu
08 Aug 2001 18:31:39 -0700


tjs@psaux.com writes:

> Actually making bcopy into memcpy isn't safe on all systems since bcopy
> deals with overlapping strings and memcpy doesn't.  (At least the
> FreeBSD bcopy manpage says that bcopy does, and memcpy maybe does but it
> depends on your implementation).

Right, yeah, that was my point.

bcopy => memmove is safe.  bcopy => memcpy is only safe if you know what's
being copied and how.  (memcpy frequently can't handle overlapping copies,
since it's a lot faster to not worry about that.  bcopy sometimes can and
sometimes can't.  memmove is required to be able to.)

-- 
Russ Allbery (rra@stanford.edu)             <http://www.eyrie.org/~eagle/>