Re: str_repeat() patch
| From: | George Schlossnagle | Date: | Sat, 12 Jun 2004 16:58:46 +0000 |
| Subject: | Re: str_repeat() patch | ||
| References: | 1 2 3 | Groups: | php.internals |
| Request: | Send a blank email to internals+get-10411@lists.php.net to get a copy of this message | ||
On Jun 12, 2004, at 10:27 AM, Alexander Valyalkin wrote:
On Fri, 11 Jun 2004 17:00:03 +0200 (CEST), Derick Rethans <derick@php.net> wrote:That's not what my glibc sources look like. GeorgeOn Fri, 11 Jun 2004, Alexander Valyalkin wrote:Mybe I'm mistaken, but I think, that memmove() looks like that (without any error checks):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.