diff options
author | Andi Gutmans <andi@php.net> | 2004-07-19 07:19:50 +0000 |
---|---|---|
committer | Andi Gutmans <andi@php.net> | 2004-07-19 07:19:50 +0000 |
commit | 56f8195fe592e79d90c78fb015f39bffa7f39422 (patch) | |
tree | 6a1bf69bc9cd23fab98c4d3d6c12368b56d26079 /ext/standard/string.c | |
parent | 599ae4b1b53d46e10447dab8fb4faa2d0517370a (diff) | |
download | php-git-56f8195fe592e79d90c78fb015f39bffa7f39422.tar.gz |
- Nuke empty_string. It is a reminanent from the time where RETURN_FALSE()
used to return "" and not bool(false). It's not worth keeping it because
STR_FREE() and zval_dtor() always have to check for it and it slows down
the general case. In addition, it seems that empty_string has been abused
quite a lot, and was used not only for setting zval's but generally in
PHP code instead of "", which wasn't the intention. Last but not least,
nuking empty_string should improve stability as I doubt every place
correctly checked if they are not mistakenly erealloc()'ing it or
calling efree() on it.
NOTE: Some code is probably broken. Each extension maintainer should
check and see that my changes are OK. Also, I haven't had time to touch
PECL yet. Will try and do it tomorrow.
Diffstat (limited to 'ext/standard/string.c')
-rw-r--r-- | ext/standard/string.c | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/ext/standard/string.c b/ext/standard/string.c index 7a7020b852..3eb4e8f707 100644 --- a/ext/standard/string.c +++ b/ext/standard/string.c @@ -3206,7 +3206,7 @@ static void php_str_replace_in_subject(zval *search, zval *replace, zval **subje convert_to_string_ex(subject); Z_TYPE_P(result) = IS_STRING; if (Z_STRLEN_PP(subject) == 0) { - ZVAL_STRINGL(result, empty_string, 0, 1); + ZVAL_STRINGL(result, "", 0, 1); return; } @@ -3254,7 +3254,7 @@ static void php_str_replace_in_subject(zval *search, zval *replace, zval **subje zend_hash_move_forward(Z_ARRVAL_P(replace)); } else { /* We've run out of replacement strings, so use an empty one. */ - replace_value = empty_string; + replace_value = ""; replace_len = 0; } } @@ -4186,11 +4186,11 @@ PHP_FUNCTION(str_repeat) /* Don't waste our time if it's empty */ if (Z_STRLEN_PP(input_str) == 0) - RETURN_STRINGL(empty_string, 0, 1); + RETURN_STRINGL("", 0, 1); /* ... or if the multiplier is zero */ if (Z_LVAL_PP(mult) == 0) - RETURN_STRINGL(empty_string, 0, 1); + RETURN_STRINGL("", 0, 1); /* Initialize the result string */ result_len = Z_STRLEN_PP(input_str) * Z_LVAL_PP(mult); |