Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:10403 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 57884 invoked by uid 1010); 11 Jun 2004 14:55:18 -0000 Delivered-To: ezmlm-scan-internals@lists.php.net Delivered-To: ezmlm-internals@lists.php.net Received: (qmail 57860 invoked from network); 11 Jun 2004 14:55:17 -0000 Received: from unknown (HELO asuka.prohost.org) (69.196.31.138) by pb1.pair.com with SMTP; 11 Jun 2004 14:55:17 -0000 Received: (qmail 12085 invoked from network); 11 Jun 2004 14:55:17 -0000 Received: from rei.nerv (HELO dummy.com) (rei@192.168.1.1) by asuka.nerv with SMTP; 11 Jun 2004 14:55:17 -0000 Reply-To: ilia@prohost.org To: internals@lists.php.net Date: Fri, 11 Jun 2004 10:55:20 -0400 User-Agent: KMail/1.6.1 References: In-Reply-To: Organization: Prohost.org MIME-Version: 1.0 Content-Disposition: inline Content-Type: text/plain; charset="koi8-r" Content-Transfer-Encoding: 7bit Message-ID: <200406111055.20833.ilia@prohost.org> Subject: Re: [PHP-DEV] str_repeat() patch From: ilia@prohost.org (Ilia Alshanetsky) 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 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/