summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndi Gutmans <andi@php.net>1999-10-15 06:31:40 +0000
committerAndi Gutmans <andi@php.net>1999-10-15 06:31:40 +0000
commit4a8cac08789ee018cee5d24e06d395b2f574870a (patch)
tree839eb257c90d7a7820ba2e701cd8e4d7155c794d
parent4d7c162d162fe46ad3b6c420bfff23c3b82b0b2c (diff)
downloadphp-git-4a8cac08789ee018cee5d24e06d395b2f574870a.tar.gz
- Converted math.c to use new convert_to_number_ex() macro.
-rw-r--r--ext/standard/math.c36
-rw-r--r--php4dllts.dsp4
-rw-r--r--tests/testarray4
-rw-r--r--tests/testfuncref2
4 files changed, 19 insertions, 27 deletions
diff --git a/ext/standard/math.c b/ext/standard/math.c
index 3753e33788..a606c28407 100644
--- a/ext/standard/math.c
+++ b/ext/standard/math.c
@@ -43,15 +43,11 @@ PHP_FUNCTION(abs)
WRONG_PARAM_COUNT;
}
- if ((*value)->type == IS_STRING) {
- zval_copy_ctor(*value);
- convert_scalar_to_number(*value);
- }
-
+ convert_scalar_to_number_ex(value);
+
if ((*value)->type == IS_DOUBLE) {
RETURN_DOUBLE(fabs((*value)->value.dval));
- }
- else if ((*value)->type == IS_LONG) {
+ } else if ((*value)->type == IS_LONG) {
RETURN_LONG(labs((*value)->value.lval));
}
@@ -70,15 +66,11 @@ PHP_FUNCTION(ceil)
WRONG_PARAM_COUNT;
}
- if ((*value)->type == IS_STRING) {
- zval_copy_ctor(*value);
- convert_scalar_to_number(*value);
- }
+ convert_scalar_to_number_ex(value);
if ((*value)->type == IS_DOUBLE) {
RETURN_LONG((long)ceil((*value)->value.dval));
- }
- else if ((*value)->type == IS_LONG) {
+ } else if ((*value)->type == IS_LONG) {
RETURN_LONG((*value)->value.lval);
}
@@ -96,15 +88,11 @@ PHP_FUNCTION(floor) {
WRONG_PARAM_COUNT;
}
- if ((*value)->type == IS_STRING) {
- zval_copy_ctor(*value);
- convert_scalar_to_number(*value);
- }
+ convert_scalar_to_number_ex(value);
if ((*value)->type == IS_DOUBLE) {
RETURN_LONG((long)floor((*value)->value.dval));
- }
- else if ((*value)->type == IS_LONG) {
+ } else if ((*value)->type == IS_LONG) {
RETURN_LONG((*value)->value.lval);
}
@@ -136,14 +124,12 @@ PHP_FUNCTION(round)
if (ARG_COUNT(ht) != 1 || getParametersEx(1, &value) == FAILURE) {
WRONG_PARAM_COUNT;
}
- if ((*value)->type == IS_STRING) {
- zval_copy_ctor(*value);
- convert_scalar_to_number(*value);
- }
+
+ convert_scalar_to_number_ex(value);
+
if ((*value)->type == IS_DOUBLE) {
RETURN_DOUBLE(rint((*value)->value.dval));
- }
- if ((*value)->type == IS_LONG) {
+ } else if ((*value)->type == IS_LONG) {
RETURN_DOUBLE((double)(*value)->value.lval);
}
RETURN_FALSE;
diff --git a/php4dllts.dsp b/php4dllts.dsp
index 8f73d1fac1..012f358640 100644
--- a/php4dllts.dsp
+++ b/php4dllts.dsp
@@ -866,6 +866,10 @@ SOURCE=.\LICENSE
# End Source File
# Begin Source File
+SOURCE=.\NEWS
+# End Source File
+# Begin Source File
+
SOURCE=".\php.ini-dist"
# End Source File
# End Group
diff --git a/tests/testarray b/tests/testarray
index 2928fff025..a8d3d66a91 100644
--- a/tests/testarray
+++ b/tests/testarray
@@ -4,11 +4,11 @@ This is a small test...
* this is a multiline comment...
*/
-//for ($j=0; $j<=200; $j++) {
+for ($j=0; $j<=20; $j++) {
for ($i[0][0]=0; $i[0][0]<10000; $i[0][0]++) {
$i[1] += $i[0][0]; // this is a single line comment
}
-//}
+}
/* this is another multi
line
diff --git a/tests/testfuncref b/tests/testfuncref
index 675c70de81..217e4d14e0 100644
--- a/tests/testfuncref
+++ b/tests/testfuncref
@@ -5,4 +5,6 @@ function foobar()
print "foobar\n";
}
+$foobar = "foobar";
+
$a = ${"foo"."bar"}();