summaryrefslogtreecommitdiff
path: root/ext/bcmath/libbcmath/src/init.c
diff options
context:
space:
mode:
authorSander Roobol <sander@php.net>2002-11-22 09:25:29 +0000
committerSander Roobol <sander@php.net>2002-11-22 09:25:29 +0000
commitf200f739d8089ac0156ea4064696d32fff45692c (patch)
tree5ba86c6a3ffcdd1229eb043df4515e345fe383dc /ext/bcmath/libbcmath/src/init.c
parent64a75d6d7714e199814a67980abdd2672c69ba07 (diff)
downloadphp-git-f200f739d8089ac0156ea4064696d32fff45692c.tar.gz
Made bcmath extension thread safe.
@Made bcmath extension thread safe. (Sander)
Diffstat (limited to 'ext/bcmath/libbcmath/src/init.c')
-rw-r--r--ext/bcmath/libbcmath/src/init.c25
1 files changed, 9 insertions, 16 deletions
diff --git a/ext/bcmath/libbcmath/src/init.c b/ext/bcmath/libbcmath/src/init.c
index 4ff00b1102..f349d82a7b 100644
--- a/ext/bcmath/libbcmath/src/init.c
+++ b/ext/bcmath/libbcmath/src/init.c
@@ -38,11 +38,6 @@
#include "bcmath.h"
#include "private.h"
-/* Storage used for special numbers. */
-bc_num _zero_;
-bc_num _one_;
-bc_num _two_;
-
bc_num _bc_Free_list = NULL;
/* new_num allocates a number and sets fields to known values. */
@@ -103,21 +98,20 @@ bc_free_num (num)
/* Intitialize the number package! */
void
-bc_init_numbers ()
+bc_init_numbers (TSRMLS_D)
{
- _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;
+ 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;
}
/* Make a copy of a number! Just increments the reference count! */
bc_num
-bc_copy_num (num)
- bc_num num;
+bc_copy_num (bc_num num)
{
num->n_refs++;
return num;
@@ -127,9 +121,8 @@ bc_copy_num (num)
/* Initialize a number NUM by making it a copy of zero. */
void
-bc_init_num (num)
- bc_num *num;
+bc_init_num (bc_num *num TSRMLS_DC)
{
- *num = bc_copy_num (_zero_);
+ *num = bc_copy_num (BCG(_zero_));
}