Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:45967 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 51778 invoked from network); 6 Nov 2009 09:05:23 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 6 Nov 2009 09:05:23 -0000 Authentication-Results: pb1.pair.com header.from=scott@macvicar.net; sender-id=unknown Authentication-Results: pb1.pair.com smtp.mail=scott@macvicar.net; spf=permerror; sender-id=unknown Received-SPF: error (pb1.pair.com: domain macvicar.net from 97.107.131.220 cause and error) X-PHP-List-Original-Sender: scott@macvicar.net X-Host-Fingerprint: 97.107.131.220 whisky.macvicar.net Linux 2.6 Received: from [97.107.131.220] ([97.107.131.220:48906] helo=whisky.macvicar.net) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id 43/56-11366-0D6E3FA4 for ; Fri, 06 Nov 2009 04:05:21 -0500 Received: from [10.167.33.212] (unknown [217.41.229.227]) by whisky.macvicar.net (Postfix) with ESMTP id 5D9D44695D; Fri, 6 Nov 2009 04:05:18 -0500 (EST) Mime-Version: 1.0 (Apple Message framework v1076) Content-Type: text/plain; charset=us-ascii; format=flowed; delsp=yes In-Reply-To: Date: Fri, 6 Nov 2009 09:05:15 +0000 Cc: internals@lists.php.net Content-Transfer-Encoding: 7bit Message-ID: <3D00FD9C-488D-4BE0-A17E-48828C24EC60@macvicar.net> References: To: daqing X-Mailer: Apple Mail (2.1076) Subject: Re: [PHP-DEV] typo found in ext/standard/string.c, inside function nl2br, php 5.3.0 svn trunk From: scott@macvicar.net (Scott MacVicar) On 6 Nov 2009, at 03:18, daqing wrote: > hi, all: > > I just found a typo today when I read the source code of function > nl2br, > here is what 'svn diff' produce against the php 5.3.0 svn trunk: > > Index: ext/standard/string.c > =================================================================== > --- ext/standard/string.c (revision 290364) > +++ ext/standard/string.c (working copy) > @@ -3918,7 +3918,7 @@ > tmp = str; > end = str + str_len; > > - /* it is really faster to scan twice and allocate mem once > insted > scanning once > + /* it is really faster to scan twice and allocate mem once > instead > scanning once > and constantly reallocing */ > while (tmp < end) { > if (*tmp == '\r') { This typo and the grammatical error are fixed now. > > > besides, I have a question: why not function nl2br just replace the > "\r\n", > "\n", "\r" things with "
"? why insert "
" before those "\r > \n", > "\n", "\r"? > Because its much easier to read the output when the newlines are preserved. Scott