Re: str_repeat() patch
| From: | Ilia Alshanetsky | Date: | Fri, 11 Jun 2004 14:55:20 +0000 |
| Subject: | Re: str_repeat() patch | ||
| References: | 1 | Groups: | php.internals |
| Request: | Send a blank email to internals+get-10403@lists.php.net to get a copy of this message | ||
Read your memcpy manpages
"The memcpy() function copies n bytes from memory area src to memory
area dest. The memory areas may not overlap."
Ilia
On June 11, 2004 10:50 am, 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() ?
>
> ===========cut=============
> --- string.c Thu May 13 20:44:32 2004
> +++ string_str_repeat.c Fri Jun 11 17:40:47 2004
> @@ -3581,7 +3581,7 @@
>
> while (e<ee) {
> l = (e-s) < (ee-e) ? (e-s) : (ee-e);
> - memmove(e, s, l);
> + memcpy(e, s, l);
> e += l;
> }
> }
>
> ===========cut=============
>
> --
> Using Opera's revolutionary e-mail client:
> http://www.opera.com/m2/