]> granicus.if.org Git - php/commitdiff
Moved ts_alloca_id() into MINIT like Andi requested.
authorfoobar <sniper@php.net>
Sun, 6 May 2001 17:55:10 +0000 (17:55 +0000)
committerfoobar <sniper@php.net>
Sun, 6 May 2001 17:55:10 +0000 (17:55 +0000)
ext/standard/basic_functions.c
ext/standard/lcg.c
ext/standard/php_lcg.h

index 2eb15a196467bb7d79e4cdee8d60e077d52f789b..356a150e08652a6f08c98b5af8179c8a8e76907e 100644 (file)
@@ -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);
index 31321a6c81adf8ff9c97bb07a189b48cccba7292..ca6e8b7fb4394f102964911e319c0ce761987325 100644 (file)
@@ -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 */
index a6d8b0c0a4a9e10c159312edbc678e6e9194e8b7..1cb5fb009ce62472508e12e1efdeb3be5a93ef12 100644 (file)
@@ -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()