cvs: php-src /ext/standard string.c

From: Date: Sun, 19 Jun 2005 16:31:52 +0000
Subject: cvs: php-src /ext/standard string.c
Groups: php.cvs 
Request: Send a blank email to php-cvs+get-32391@lists.php.net to get a copy of this message
iliaa Sun Jun 19 12:31:52 2005 EDT Modified files: /php-src/ext/standard string.c Log: make substr_count() 30% when counting instances of 1 byte long strings. http://cvs.php.net/diff.php/php-src/ext/standard/string.c?r1=1.440&r2=1.441&ty=u Index: php-src/ext/standard/string.c diff -u php-src/ext/standard/string.c:1.440 php-src/ext/standard/string.c:1.441 --- php-src/ext/standard/string.c:1.440 Sat Jun 18 14:23:12 2005 +++ php-src/ext/standard/string.c Sun Jun 19 12:31:51 2005 @@ -18,7 +18,7 @@ +----------------------------------------------------------------------+ */ -/* $Id: string.c,v 1.440 2005/06/18 18:23:12 iliaa Exp $ */ +/* $Id: string.c,v 1.441 2005/06/19 16:31:51 iliaa Exp $ */ /* Synced with php 3.0 revision 1.193 1999-06-16 [ssb] */ @@ -4463,11 +4463,10 @@ if (Z_STRLEN_PP(needle) == 1) { cmp = Z_STRVAL_PP(needle)[0]; - - while (p < endp) { - if (*(p++) == cmp) { - count++; - } + + while ((p = memchr(p, cmp, endp - p))) { + count++; + p++; } } else { while ((p = php_memnstr(p, Z_STRVAL_PP(needle), Z_STRLEN_PP(needle), endp))) {

« previous php.cvs (#32391) next »