cvs: php4 /ext/standard basic_functions.c lcg.c php_lcg.h

From: Date: Sun, 06 May 2001 17:55:10 +0000
Subject: cvs: php4 /ext/standard basic_functions.c lcg.c php_lcg.h
Groups: php.cvs 
Request: Send a blank email to php-cvs+get-5566@lists.php.net to get a copy of this message
sniper Sun May 6 10:55:10 2001 EDT Modified files: /php4/ext/standard basic_functions.c lcg.c php_lcg.h Log: Moved ts_alloca_id() into MINIT like Andi requested. Index: php4/ext/standard/basic_functions.c diff -u php4/ext/standard/basic_functions.c:1.328 php4/ext/standard/basic_functions.c:1.329 --- php4/ext/standard/basic_functions.c:1.328 Sun May 6 09:54:27 2001 +++ php4/ext/standard/basic_functions.c Sun May 6 10:55:10 2001 @@ -17,7 +17,7 @@ +----------------------------------------------------------------------+ */ -/* $Id: basic_functions.c,v 1.328 2001/05/06 16:54:27 sniper Exp $ */ +/* $Id: basic_functions.c,v 1.329 2001/05/06 17:55:10 sniper Exp $ */ #include "php.h" #include "php_main.h" @@ -755,6 +755,10 @@ PHP_MINIT(crypt)(INIT_FUNC_ARGS_PASSTHRU); #endif +#ifdef ZTS + PHP_MINIT(lcg)(INIT_FUNC_ARGS_PASSTHRU); +#endif + PHP_MINIT(dir)(INIT_FUNC_ARGS_PASSTHRU); PHP_MINIT(syslog)(INIT_FUNC_ARGS_PASSTHRU); PHP_MINIT(array)(INIT_FUNC_ARGS_PASSTHRU); @@ -837,7 +841,10 @@ PHP_RINIT(crypt)(INIT_FUNC_ARGS_PASSTHRU); #endif +#ifndef ZTS PHP_RINIT(lcg)(INIT_FUNC_ARGS_PASSTHRU); +#endif + PHP_RINIT(head)(INIT_FUNC_ARGS_PASSTHRU); PHP_RINIT(filestat)(INIT_FUNC_ARGS_PASSTHRU); PHP_RINIT(syslog)(INIT_FUNC_ARGS_PASSTHRU); Index: php4/ext/standard/lcg.c diff -u php4/ext/standard/lcg.c:1.16 php4/ext/standard/lcg.c:1.17 --- php4/ext/standard/lcg.c:1.16 Sun May 6 09:54:27 2001 +++ php4/ext/standard/lcg.c Sun May 6 10:55:10 2001 @@ -1,4 +1,4 @@ -/* +/* +----------------------------------------------------------------------+ | PHP version 4.0 | +----------------------------------------------------------------------+ @@ -16,7 +16,7 @@ +----------------------------------------------------------------------+ */ -/* $Id: lcg.c,v 1.16 2001/05/06 16:54:27 sniper Exp $ */ +/* $Id: lcg.c,v 1.17 2001/05/06 17:55:10 sniper Exp $ */ #include "php.h" #include "php_lcg.h" @@ -73,18 +73,22 @@ #endif } +#ifdef ZTS +PHP_MINIT_FUNCTION(lcg) +{ + lcg_globals_id = ts_allocate_id(sizeof(php_lcg_globals), (ts_allocate_ctor) lcg_init_globals, NULL); + return SUCCESS; +} +#else PHP_RINIT_FUNCTION(lcg) { if (!php_lcg_initialized) { -#ifdef ZTS - lcg_globals_id = ts_allocate_id(sizeof(php_lcg_globals), (ts_allocate_ctor) lcg_init_globals, NULL); -#else lcg_init_globals(); -#endif php_lcg_initialized = 1; } return SUCCESS; } +#endif /* {{{ proto double lcg_value() Returns a value from the combined linear congruential generator */ Index: php4/ext/standard/php_lcg.h diff -u php4/ext/standard/php_lcg.h:1.10 php4/ext/standard/php_lcg.h:1.11 --- php4/ext/standard/php_lcg.h:1.10 Sun May 6 09:54:27 2001 +++ php4/ext/standard/php_lcg.h Sun May 6 10:55:10 2001 @@ -16,7 +16,7 @@ +----------------------------------------------------------------------+ */ -/* $Id: php_lcg.h,v 1.10 2001/05/06 16:54:27 sniper Exp $ */ +/* $Id: php_lcg.h,v 1.11 2001/05/06 17:55:10 sniper Exp $ */ #ifndef PHP_LCG_H #define PHP_LCG_H @@ -28,13 +28,14 @@ double php_combined_lcg(void); PHP_FUNCTION(lcg_value); -PHP_RINIT_FUNCTION(lcg); #ifdef ZTS +PHP_MINIT_FUNCTION(lcg); #define LCGLS_D php_lcg_globals *lcg_globals #define LCG(v) (lcg_globals->v) #define LCGLS_FETCH() php_lcg_globals *lcg_globals = ts_resource(lcg_globals_id) #else +PHP_RINIT_FUNCTION(lcg); #define LCGLS_D void #define LCG(v) (lcg_globals.v) #define LCGLS_FETCH()

« previous php.cvs (#5566) next »