summaryrefslogtreecommitdiff
path: root/ext
diff options
context:
space:
mode:
authorfoobar <sniper@php.net>2001-05-06 17:55:10 +0000
committerfoobar <sniper@php.net>2001-05-06 17:55:10 +0000
commit6c21f7ef0f88613c26aa0b33abba5c5112d9f004 (patch)
tree217906eaa0fd5637dea4c33b36b2fd28c7c240ae /ext
parent8e006f81afa692ebef76e10b75de2b9361a480d5 (diff)
downloadphp-git-6c21f7ef0f88613c26aa0b33abba5c5112d9f004.tar.gz
Moved ts_alloca_id() into MINIT like Andi requested.
Diffstat (limited to 'ext')
-rw-r--r--ext/standard/basic_functions.c7
-rw-r--r--ext/standard/lcg.c14
-rw-r--r--ext/standard/php_lcg.h3
3 files changed, 18 insertions, 6 deletions
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()