summaryrefslogtreecommitdiff
path: root/ext/standard/math.c
diff options
context:
space:
mode:
authorAndi Gutmans <andi@php.net>2004-07-19 07:19:50 +0000
committerAndi Gutmans <andi@php.net>2004-07-19 07:19:50 +0000
commit56f8195fe592e79d90c78fb015f39bffa7f39422 (patch)
tree6a1bf69bc9cd23fab98c4d3d6c12368b56d26079 /ext/standard/math.c
parent599ae4b1b53d46e10447dab8fb4faa2d0517370a (diff)
downloadphp-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/math.c')
-rw-r--r--ext/standard/math.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/ext/standard/math.c b/ext/standard/math.c
index 1ab898569b..8a2b3ecec1 100644
--- a/ext/standard/math.c
+++ b/ext/standard/math.c
@@ -791,7 +791,7 @@ _php_math_longtobase(zval *arg, int base)
unsigned long value;
if (Z_TYPE_P(arg) != IS_LONG || base < 2 || base > 36) {
- return empty_string;
+ return STR_EMPTY_ALLOC();
}
value = Z_LVAL_P(arg);
@@ -820,7 +820,7 @@ _php_math_zvaltobase(zval *arg, int base TSRMLS_DC)
static char digits[] = "0123456789abcdefghijklmnopqrstuvwxyz";
if ((Z_TYPE_P(arg) != IS_LONG && Z_TYPE_P(arg) != IS_DOUBLE) || base < 2 || base > 36) {
- return empty_string;
+ return STR_EMPTY_ALLOC();
}
if (Z_TYPE_P(arg) == IS_DOUBLE) {
@@ -831,7 +831,7 @@ _php_math_zvaltobase(zval *arg, int base TSRMLS_DC)
/* Don't try to convert +/- infinity */
if (fvalue == HUGE_VAL || fvalue == -HUGE_VAL) {
php_error_docref(NULL TSRMLS_CC, E_WARNING, "Number too large");
- return empty_string;
+ return STR_EMPTY_ALLOC();
}
end = ptr = buf + sizeof(buf) - 1;