cvs: php4 /ext/bcmath bcmath.c php_bcmath.h

From: Date: Tue, 18 Jun 2002 18:51:34 +0000
Subject: cvs: php4 /ext/bcmath bcmath.c php_bcmath.h
Groups: php.cvs 
Request: Send a blank email to php-cvs+get-12411@lists.php.net to get a copy of this message
andi Tue Jun 18 14:51:34 2002 EDT Modified files: /php4/ext/bcmath bcmath.c php_bcmath.h Log: - Nuke use of persist_alloc(). This can't be used with a new memory manager Index: php4/ext/bcmath/bcmath.c diff -u php4/ext/bcmath/bcmath.c:1.36 php4/ext/bcmath/bcmath.c:1.37 --- php4/ext/bcmath/bcmath.c:1.36 Thu Feb 28 03:25:41 2002 +++ php4/ext/bcmath/bcmath.c Tue Jun 18 14:51:33 2002 @@ -16,7 +16,7 @@ +----------------------------------------------------------------------+ */ -/* $Id: bcmath.c,v 1.36 2002/02/28 08:25:41 sebastian Exp $ */ +/* $Id: bcmath.c,v 1.37 2002/06/18 18:51:33 andi Exp $ */ #ifdef HAVE_CONFIG_H #include "config.h" @@ -47,10 +47,10 @@ STANDARD_MODULE_HEADER, "bcmath", bcmath_functions, - PHP_MINIT(bcmath), - PHP_MSHUTDOWN(bcmath), - PHP_RINIT(bcmath), NULL, + NULL, + PHP_RINIT(bcmath), + PHP_RSHUTDOWN(bcmath), PHP_MINFO(bcmath), NO_VERSION_YET, STANDARD_MODULE_PROPERTIES @@ -65,9 +65,9 @@ #endif /* Storage used for special numbers. */ -bc_num _zero_; -bc_num _one_; -bc_num _two_; +extern bc_num _zero_; +extern bc_num _one_; +extern bc_num _two_; /* Make a copy of a number! Just increments the reference count! */ @@ -85,34 +85,12 @@ } -PHP_MINIT_FUNCTION(bcmath) -{ - extern bc_num _zero_; - extern bc_num _one_; - extern bc_num _two_; - - _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; - persist_alloc(_zero_); - persist_alloc(_one_); - persist_alloc(_two_); - persist_alloc(_zero_->n_ptr); - persist_alloc(_one_->n_ptr); - persist_alloc(_two_->n_ptr); - - return SUCCESS; -} - - - -PHP_MSHUTDOWN_FUNCTION(bcmath) +PHP_RSHUTDOWN_FUNCTION(bcmath) { bc_free_num(&_zero_); bc_free_num(&_one_); bc_free_num(&_two_); + return SUCCESS; } @@ -122,6 +100,9 @@ if (cfg_get_long("bcmath.scale", &bc_precision)==FAILURE) { bc_precision=0; } + + bc_init_numbers(); + return SUCCESS; } Index: php4/ext/bcmath/php_bcmath.h diff -u php4/ext/bcmath/php_bcmath.h:1.10 php4/ext/bcmath/php_bcmath.h:1.11 --- php4/ext/bcmath/php_bcmath.h:1.10 Thu Feb 28 03:25:42 2002 +++ php4/ext/bcmath/php_bcmath.h Tue Jun 18 14:51:33 2002 @@ -16,7 +16,7 @@ +----------------------------------------------------------------------+ */ -/* $Id: php_bcmath.h,v 1.10 2002/02/28 08:25:42 sebastian Exp $ */ +/* $Id: php_bcmath.h,v 1.11 2002/06/18 18:51:33 andi Exp $ */ #ifndef PHP_BCMATH_H #define PHP_BCMATH_H @@ -26,9 +26,8 @@ extern zend_module_entry bcmath_module_entry; #define phpext_bcmath_ptr &bcmath_module_entry -PHP_MINIT_FUNCTION(bcmath); -PHP_MSHUTDOWN_FUNCTION(bcmath); PHP_RINIT_FUNCTION(bcmath); +PHP_RSHUTDOWN_FUNCTION(bcmath); PHP_MINFO_FUNCTION(bcmath); PHP_FUNCTION(bcadd);

« previous php.cvs (#12411) next »