Re: typo found in ext/standard/string.c, inside function nl2br, php 5.3.0 svn trunk
| From: | Scott MacVicar | Date: | Fri, 06 Nov 2009 09:05:15 +0000 |
| Subject: | Re: typo found in ext/standard/string.c, inside function nl2br, php 5.3.0 svn trunk | ||
| References: | 1 | Groups: | php.internals |
| Request: | Send a blank email to internals+get-45967@lists.php.net to get a copy of this message | ||
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 ===================================================================This typo and the grammatical error are fixed now.--- 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 instedscanning once+ /* it is really faster to scan twice and allocate mem once insteadscanning onceand constantly reallocing */ while (tmp < end) { if (*tmp == '\r') {
besides, I have a question: why not function nl2br just replace the "\r\n", "\n", "\r" things with "<br/>"? why insert "<br/>" before those "\r\n", "\n", "\r"?Because its much easier to read the output when the newlines are preserved. Scott