com php-src: Improve codes: ext/standard/string.c
| From: | Dmitry Stogov | Date: | Fri, 07 Mar 2014 14:33:36 +0000 |
| Subject: | com php-src: Improve codes: ext/standard/string.c | ||
| Groups: | php.cvs | ||
| Request: | Send a blank email to php-cvs+get-77677@lists.php.net to get a copy of this message | ||
Commit: 3f794ba743c0b96c4834d914ef45ab909c26bb13
Author: Xinchen Hui <laruence@gmail.com> Fri, 7 Mar 2014 22:33:36 +0800
Parents: f0989e332f7663536f909e2485fb5198dc06acc8
Branches: phpng
Link: http://git.php.net/?p=php-src.git;a=commitdiff;h=3f794ba743c0b96c4834d914ef45ab909c26bb13
Log:
Improve codes
Changed paths:
M ext/standard/string.c
Diff:
diff --git a/ext/standard/string.c b/ext/standard/string.c
index 98b6547..5bfffa0 100644
--- a/ext/standard/string.c
+++ b/ext/standard/string.c
@@ -5347,7 +5347,7 @@ PHP_FUNCTION(str_shuffle)
*/
PHP_FUNCTION(str_word_count)
{
- char c, *str, *char_list = NULL, *p, *e, *s, ch[256];
+ char *str, *char_list = NULL, *p, *e, *s, ch[256];
int str_len, char_list_len = 0, word_count = 0;
long type = 0;
@@ -5399,16 +5399,10 @@ PHP_FUNCTION(str_word_count)
switch (type)
{
case 1:
- c = s[p - s];
- s[p - s] = '\0';
add_next_index_stringl(return_value, s, p - s, 1);
- s[p - s] = c;
break;
case 2:
- c = s[p - s];
- s[p - s] = '\0';
add_index_stringl(return_value, (s - str), s, p - s, 1);
- s[p - s] = c;
break;
default:
word_count++;