Well, surely memmove() needs an additional branch to check for overlapping, though (the OP was wrong in that memmove() would need a temporary buffer, though - it doesn't, it usually copies from high addres to low in the overlapping case).

Cheers,
Michael

George Schlossnagle wrote:

On Jun 12, 2004, at 10:27 AM, Alexander Valyalkin wrote:

On Fri, 11 Jun 2004 17:00:03 +0200 (CEST), Derick Rethans <[EMAIL PROTECTED]> wrote:

On Fri, 11 Jun 2004, Alexander Valyalkin wrote:


Read it:
void *memmove(void *s1, const void *s2, size_t n);
If s1 and s2 overlap, all bytes are copied in a preserving manner (unlike
memcpy())


And anwer the question: are s1 and s2 overlap in the str_repeat() ?
Why don't use memcpy() instead of memmove() ?


Because it's slower and we're copying to newly allocated memory anyway
so things CAN not overlap. Also, your patch is the wrong way around.


Mybe I'm mistaken, but I think, that memmove() looks like that (without any error checks):


That's not what my glibc sources look like.

George


-- PHP Internals - PHP Runtime Development Mailing List To unsubscribe, visit: http://www.php.net/unsub.php



Reply via email to