summaryrefslogtreecommitdiff
path: root/ext/bcmath
diff options
context:
space:
mode:
authorSara Golemon <pollita@php.net>2003-02-04 21:39:50 +0000
committerSara Golemon <pollita@php.net>2003-02-04 21:39:50 +0000
commitf757c17b2f7c3a1ddd7ecc05b822a48860435be8 (patch)
tree68110c066ef4777c25a481bcdbe65ff08bec1994 /ext/bcmath
parentbf496a03cfce8ea434cf17f7c88b7e4eb91b1a4c (diff)
downloadphp-git-f757c17b2f7c3a1ddd7ecc05b822a48860435be8.tar.gz
FMH(r-1.49/r-1.50)
Diffstat (limited to 'ext/bcmath')
-rw-r--r--ext/bcmath/bcmath.c25
1 files changed, 13 insertions, 12 deletions
diff --git a/ext/bcmath/bcmath.c b/ext/bcmath/bcmath.c
index b66b5606d2..cd24536ae3 100644
--- a/ext/bcmath/bcmath.c
+++ b/ext/bcmath/bcmath.c
@@ -112,7 +112,8 @@ PHP_MINFO_FUNCTION(bcmath)
/* {{{ php_str2num
Convert to bc_num detecting scale */
-static void php_str2num(bc_num *num, char *str) {
+static void php_str2num(bc_num *num, char *str TSRMLS_DC)
+{
char *p;
if (!(p = strchr(str, '.'))) {
@@ -154,8 +155,8 @@ PHP_FUNCTION(bcadd)
bc_init_num(&first TSRMLS_CC);
bc_init_num(&second TSRMLS_CC);
bc_init_num(&result TSRMLS_CC);
- php_str2num(&first, Z_STRVAL_PP(left));
- php_str2num(&second, Z_STRVAL_PP(right));
+ php_str2num(&first, Z_STRVAL_PP(left) TSRMLS_CC);
+ php_str2num(&second, Z_STRVAL_PP(right) TSRMLS_CC);
bc_add (first, second, &result, scale);
result->n_scale = scale;
Z_STRVAL_P(return_value) = bc_num2str(result);
@@ -198,8 +199,8 @@ PHP_FUNCTION(bcsub)
bc_init_num(&first TSRMLS_CC);
bc_init_num(&second TSRMLS_CC);
bc_init_num(&result TSRMLS_CC);
- php_str2num(&first, Z_STRVAL_PP(left));
- php_str2num(&second, Z_STRVAL_PP(right));
+ php_str2num(&first, Z_STRVAL_PP(left) TSRMLS_CC);
+ php_str2num(&second, Z_STRVAL_PP(right) TSRMLS_CC);
bc_sub (first, second, &result, scale);
result->n_scale = scale;
Z_STRVAL_P(return_value) = bc_num2str(result);
@@ -242,8 +243,8 @@ PHP_FUNCTION(bcmul)
bc_init_num(&first TSRMLS_CC);
bc_init_num(&second TSRMLS_CC);
bc_init_num(&result TSRMLS_CC);
- php_str2num(&first, Z_STRVAL_PP(left));
- php_str2num(&second, Z_STRVAL_PP(right));
+ php_str2num(&first, Z_STRVAL_PP(left) TSRMLS_CC);
+ php_str2num(&second, Z_STRVAL_PP(right) TSRMLS_CC);
bc_multiply (first, second, &result, scale TSRMLS_CC);
result->n_scale = scale;
Z_STRVAL_P(return_value) = bc_num2str(result);
@@ -286,8 +287,8 @@ PHP_FUNCTION(bcdiv)
bc_init_num(&first TSRMLS_CC);
bc_init_num(&second TSRMLS_CC);
bc_init_num(&result TSRMLS_CC);
- php_str2num(&first, Z_STRVAL_PP(left));
- php_str2num(&second, Z_STRVAL_PP(right));
+ php_str2num(&first, Z_STRVAL_PP(left) TSRMLS_CC);
+ php_str2num(&second, Z_STRVAL_PP(right) TSRMLS_CC);
switch (bc_divide (first, second, &result, scale TSRMLS_CC)) {
case 0: /* OK */
result->n_scale = scale;
@@ -377,8 +378,8 @@ PHP_FUNCTION(bcpow)
bc_init_num(&first TSRMLS_CC);
bc_init_num(&second TSRMLS_CC);
bc_init_num(&result TSRMLS_CC);
- php_str2num(&first, Z_STRVAL_PP(left));
- php_str2num(&second, Z_STRVAL_PP(right));
+ php_str2num(&first, Z_STRVAL_PP(left) TSRMLS_CC);
+ php_str2num(&second, Z_STRVAL_PP(right) TSRMLS_CC);
bc_raise (first, second, &result, scale TSRMLS_CC);
result->n_scale = scale;
Z_STRVAL_P(return_value) = bc_num2str(result);
@@ -418,7 +419,7 @@ PHP_FUNCTION(bcsqrt)
}
convert_to_string_ex(left);
bc_init_num(&result TSRMLS_CC);
- php_str2num(&result, Z_STRVAL_PP(left));
+ php_str2num(&result, Z_STRVAL_PP(left) TSRMLS_CC);
if (bc_sqrt (&result, scale TSRMLS_CC) != 0) {
result->n_scale = scale;
Z_STRVAL_P(return_value) = bc_num2str(result);