andi Wed Nov 20 15:03:02 2002 EDT
Modified files:
/php4/ext/bcmath bcmath.c
/php4/ext/bcmath/libbcmath/src bcmath.h init.c output.c raise.c
raisemod.c recmul.c sqrt.c str2num.c
zero.c
Log:
- Revert previous patch
Index: php4/ext/bcmath/bcmath.c
diff -u php4/ext/bcmath/bcmath.c:1.40 php4/ext/bcmath/bcmath.c:1.41
--- php4/ext/bcmath/bcmath.c:1.40 Wed Nov 20 14:48:12 2002
+++ php4/ext/bcmath/bcmath.c Wed Nov 20 15:03:00 2002
@@ -16,7 +16,7 @@
+----------------------------------------------------------------------+
*/
-/* $Id: bcmath.c,v 1.40 2002/11/20 19:48:12 andi Exp $ */
+/* $Id: bcmath.c,v 1.41 2002/11/20 20:03:00 andi Exp $ */
#ifdef HAVE_CONFIG_H
#include "config.h"
@@ -65,9 +65,9 @@
#endif
/* Storage used for special numbers. */
-extern bc_num BCG(_zero_);
-extern bc_num BCG(_one_);
-extern bc_num BCG(_two_);
+extern bc_num _zero_;
+extern bc_num _one_;
+extern bc_num _two_;
/* Make a copy of a number! Just increments the reference count! */
@@ -81,15 +81,15 @@
/* Initialize a number NUM by making it a copy of zero. */
void init_num (bc_num *num)
{
- *num = copy_num (BCG(_zero_));
+ *num = copy_num (_zero_);
}
PHP_RSHUTDOWN_FUNCTION(bcmath)
{
- bc_free_num(&BCG(_zero_));
- bc_free_num(&BCG(_one_));
- bc_free_num(&BCG(_two_));
+ bc_free_num(&_zero_);
+ bc_free_num(&_one_);
+ bc_free_num(&_two_);
return SUCCESS;
}
Index: php4/ext/bcmath/libbcmath/src/bcmath.h
diff -u php4/ext/bcmath/libbcmath/src/bcmath.h:1.3
php4/ext/bcmath/libbcmath/src/bcmath.h:1.4
--- php4/ext/bcmath/libbcmath/src/bcmath.h:1.3 Wed Nov 20 14:48:12 2002
+++ php4/ext/bcmath/libbcmath/src/bcmath.h Wed Nov 20 15:03:01 2002
@@ -80,11 +80,11 @@
#define LONG_MAX 0x7ffffff
#endif
-#define BCG(s) s##a
+
/* Global numbers. */
-extern bc_num BCG(_zero_);
-extern bc_num BCG(_one_);
-extern bc_num BCG(_two_);
+extern bc_num _zero_;
+extern bc_num _one_;
+extern bc_num _two_;
/* Function Prototypes */
Index: php4/ext/bcmath/libbcmath/src/init.c
diff -u php4/ext/bcmath/libbcmath/src/init.c:1.2
php4/ext/bcmath/libbcmath/src/init.c:1.3
--- php4/ext/bcmath/libbcmath/src/init.c:1.2 Wed Nov 20 14:48:12 2002
+++ php4/ext/bcmath/libbcmath/src/init.c Wed Nov 20 15:03:01 2002
@@ -39,9 +39,9 @@
#include "private.h"
/* Storage used for special numbers. */
-bc_num BCG(_zero_);
-bc_num BCG(_one_);
-bc_num BCG(_two_);
+bc_num _zero_;
+bc_num _one_;
+bc_num _two_;
bc_num _bc_Free_list = NULL;
@@ -105,11 +105,11 @@
void
bc_init_numbers ()
{
- BCG(_zero_) = bc_new_num (1,0);
- BCG(_one_) = bc_new_num (1,0);
- BCG(_one_)->n_value[0] = 1;
- BCG(_two_) = bc_new_num (1,0);
- BCG(_two_)->n_value[0] = 2;
+ _zero_ = bc_new_num (1,0);
+ _one_ = bc_new_num (1,0);
+ _one_->n_value[0] = 1;
+ _two_ = bc_new_num (1,0);
+ _two_->n_value[0] = 2;
}
@@ -130,6 +130,6 @@
bc_init_num (num)
bc_num *num;
{
- *num = bc_copy_num (BCG(_zero_));
+ *num = bc_copy_num (_zero_);
}
Index: php4/ext/bcmath/libbcmath/src/output.c
diff -u php4/ext/bcmath/libbcmath/src/output.c:1.3
php4/ext/bcmath/libbcmath/src/output.c:1.4
--- php4/ext/bcmath/libbcmath/src/output.c:1.3 Wed Nov 20 14:48:12 2002
+++ php4/ext/bcmath/libbcmath/src/output.c Wed Nov 20 15:03:01 2002
@@ -138,7 +138,7 @@
/* The number is some other base. */
digits = NULL;
bc_init_num (&int_part);
- bc_divide (num, BCG(_one_), &int_part, 0);
+ bc_divide (num, _one_, &int_part, 0);
bc_init_num (&frac_part);
bc_init_num (&cur_dig);
bc_init_num (&base);
@@ -185,7 +185,7 @@
{
(*out_char) ('.');
pre_space = 0;
- t_num = bc_copy_num (BCG(_one_));
+ t_num = bc_copy_num (_one_);
while (t_num->n_len <= num->n_scale) {
bc_multiply (frac_part, base, &frac_part, num->n_scale);
fdigit = bc_num2long (frac_part);
Index: php4/ext/bcmath/libbcmath/src/raise.c
diff -u php4/ext/bcmath/libbcmath/src/raise.c:1.2
php4/ext/bcmath/libbcmath/src/raise.c:1.3
--- php4/ext/bcmath/libbcmath/src/raise.c:1.2 Wed Nov 20 14:48:12 2002
+++ php4/ext/bcmath/libbcmath/src/raise.c Wed Nov 20 15:03:01 2002
@@ -66,7 +66,7 @@
if (exponent == 0)
{
bc_free_num (result);
- *result = bc_copy_num (BCG(_one_));
+ *result = bc_copy_num (_one_);
return;
}
@@ -111,7 +111,7 @@
/* Assign the value. */
if (neg)
{
- bc_divide (BCG(_one_), temp, result, rscale);
+ bc_divide (_one_, temp, result, rscale);
bc_free_num (&temp);
}
else
Index: php4/ext/bcmath/libbcmath/src/raisemod.c
diff -u php4/ext/bcmath/libbcmath/src/raisemod.c:1.2
php4/ext/bcmath/libbcmath/src/raisemod.c:1.3
--- php4/ext/bcmath/libbcmath/src/raisemod.c:1.2 Wed Nov 20 14:48:12 2002
+++ php4/ext/bcmath/libbcmath/src/raisemod.c Wed Nov 20 15:03:01 2002
@@ -57,7 +57,7 @@
/* Set initial values. */
power = bc_copy_num (base);
exponent = bc_copy_num (expo);
- temp = bc_copy_num (BCG(_one_));
+ temp = bc_copy_num (_one_);
bc_init_num(&parity);
/* Check the base for scale digits. */
@@ -68,7 +68,7 @@
if (exponent->n_scale != 0)
{
bc_rt_warn ("non-zero scale in exponent");
- bc_divide (exponent, BCG(_one_), &exponent, 0); /*truncate */
+ bc_divide (exponent, _one_, &exponent, 0); /*truncate */
}
/* Check the modulus for scale digits. */
@@ -79,7 +79,7 @@
rscale = MAX(scale, base->n_scale);
while ( !bc_is_zero(exponent) )
{
- (void) bc_divmod (exponent, BCG(_two_), &exponent, &parity, 0);
+ (void) bc_divmod (exponent, _two_, &exponent, &parity, 0);
if ( !bc_is_zero(parity) )
{
bc_multiply (temp, power, &temp, rscale);
Index: php4/ext/bcmath/libbcmath/src/recmul.c
diff -u php4/ext/bcmath/libbcmath/src/recmul.c:1.3
php4/ext/bcmath/libbcmath/src/recmul.c:1.4
--- php4/ext/bcmath/libbcmath/src/recmul.c:1.3 Wed Nov 20 14:48:12 2002
+++ php4/ext/bcmath/libbcmath/src/recmul.c Wed Nov 20 15:03:01 2002
@@ -197,14 +197,14 @@
/* Split u and v. */
if (ulen < n) {
- u1 = bc_copy_num (BCG(_zero_));
+ u1 = bc_copy_num (_zero_);
u0 = new_sub_num (ulen,0, u->n_value);
} else {
u1 = new_sub_num (ulen-n, 0, u->n_value);
u0 = new_sub_num (n, 0, u->n_value+ulen-n);
}
if (vlen < n) {
- v1 = bc_copy_num (BCG(_zero_));
+ v1 = bc_copy_num (_zero_);
v0 = new_sub_num (vlen,0, v->n_value);
} else {
v1 = new_sub_num (vlen-n, 0, v->n_value);
@@ -231,17 +231,17 @@
/* Do recursive multiplies and shifted adds. */
if (m1zero)
- m1 = bc_copy_num (BCG(_zero_));
+ m1 = bc_copy_num (_zero_);
else
_bc_rec_mul (u1, u1->n_len, v1, v1->n_len, &m1, 0);
if (bc_is_zero(d1) || bc_is_zero(d2))
- m2 = bc_copy_num (BCG(_zero_));
+ m2 = bc_copy_num (_zero_);
else
_bc_rec_mul (d1, d1len, d2, d2len, &m2, 0);
if (bc_is_zero(u0) || bc_is_zero(v0))
- m3 = bc_copy_num (BCG(_zero_));
+ m3 = bc_copy_num (_zero_);
else
_bc_rec_mul (u0, u0->n_len, v0, v0->n_len, &m3, 0);
Index: php4/ext/bcmath/libbcmath/src/sqrt.c
diff -u php4/ext/bcmath/libbcmath/src/sqrt.c:1.2
php4/ext/bcmath/libbcmath/src/sqrt.c:1.3
--- php4/ext/bcmath/libbcmath/src/sqrt.c:1.2 Wed Nov 20 14:48:12 2002
+++ php4/ext/bcmath/libbcmath/src/sqrt.c Wed Nov 20 15:03:01 2002
@@ -51,7 +51,7 @@
bc_num guess, guess1, point5, diff;
/* Initial checks. */
- cmp_res = bc_compare (*num, BCG(_zero_));
+ cmp_res = bc_compare (*num, _zero_);
if (cmp_res < 0)
return 0; /* error */
else
@@ -59,15 +59,15 @@
if (cmp_res == 0)
{
bc_free_num (num);
- *num = bc_copy_num (BCG(_zero_));
+ *num = bc_copy_num (_zero_);
return 1;
}
}
- cmp_res = bc_compare (*num, BCG(_one_));
+ cmp_res = bc_compare (*num, _one_);
if (cmp_res == 0)
{
bc_free_num (num);
- *num = bc_copy_num (BCG(_one_));
+ *num = bc_copy_num (_one_);
return 1;
}
@@ -84,7 +84,7 @@
if (cmp_res < 0)
{
/* The number is between 0 and 1. Guess should start at 1. */
- guess = bc_copy_num (BCG(_one_));
+ guess = bc_copy_num (_one_);
cscale = (*num)->n_scale;
}
else
@@ -121,7 +121,7 @@
/* Assign the number and clean up. */
bc_free_num (num);
- bc_divide (guess,BCG(_one_),num,rscale);
+ bc_divide (guess,_one_,num,rscale);
bc_free_num (&guess);
bc_free_num (&guess1);
bc_free_num (&point5);
Index: php4/ext/bcmath/libbcmath/src/str2num.c
diff -u php4/ext/bcmath/libbcmath/src/str2num.c:1.2
php4/ext/bcmath/libbcmath/src/str2num.c:1.3
--- php4/ext/bcmath/libbcmath/src/str2num.c:1.2 Wed Nov 20 14:48:12 2002
+++ php4/ext/bcmath/libbcmath/src/str2num.c Wed Nov 20 15:03:01 2002
@@ -65,7 +65,7 @@
while (isdigit((int)*ptr)) ptr++, strscale++; /* digits */
if ((*ptr != '\0') || (digits+strscale == 0))
{
- *num = bc_copy_num (BCG(_zero_));
+ *num = bc_copy_num (_zero_);
return;
}
Index: php4/ext/bcmath/libbcmath/src/zero.c
diff -u php4/ext/bcmath/libbcmath/src/zero.c:1.2
php4/ext/bcmath/libbcmath/src/zero.c:1.3
--- php4/ext/bcmath/libbcmath/src/zero.c:1.2 Wed Nov 20 14:48:12 2002
+++ php4/ext/bcmath/libbcmath/src/zero.c Wed Nov 20 15:03:01 2002
@@ -48,7 +48,7 @@
char *nptr;
/* Quick check. */
- if (num == BCG(_zero_)) return TRUE;
+ if (num == _zero_) return TRUE;
/* Initialize */
count = num->n_len + num->n_scale;
--
PHP CVS Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php