From: foobar Date: Sun, 6 May 2001 17:55:10 +0000 (+0000) Subject: Moved ts_alloca_id() into MINIT like Andi requested. X-Git-Tag: php-4.0.6RC1~108 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=6c21f7ef0f88613c26aa0b33abba5c5112d9f004;p=php Moved ts_alloca_id() into MINIT like Andi requested. --- diff --git a/ext/standard/basic_functions.c b/ext/standard/basic_functions.c index 2eb15a1964..356a150e08 100644 --- a/ext/standard/basic_functions.c +++ b/ext/standard/basic_functions.c @@ -755,6 +755,10 @@ PHP_MINIT_FUNCTION(basic) 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_FUNCTION(basic) 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); diff --git a/ext/standard/lcg.c b/ext/standard/lcg.c index 31321a6c81..ca6e8b7fb4 100644 --- a/ext/standard/lcg.c +++ b/ext/standard/lcg.c @@ -1,4 +1,4 @@ -/* +/* +----------------------------------------------------------------------+ | PHP version 4.0 | +----------------------------------------------------------------------+ @@ -73,18 +73,22 @@ static void lcg_init_globals(LCGLS_D) #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 */ diff --git a/ext/standard/php_lcg.h b/ext/standard/php_lcg.h index a6d8b0c0a4..1cb5fb009c 100644 --- a/ext/standard/php_lcg.h +++ b/ext/standard/php_lcg.h @@ -28,13 +28,14 @@ typedef struct { 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()