diff options
| author | Thies C. Arntzen <thies@php.net> | 1999-12-09 11:02:41 +0000 | 
|---|---|---|
| committer | Thies C. Arntzen <thies@php.net> | 1999-12-09 11:02:41 +0000 | 
| commit | 99b5652f409e0910c6108e92ac95c435a394de72 (patch) | |
| tree | c010b9e32cddce1812cef9fa97dd6147bfb9bb66 | |
| parent | 25096ac9e93e7caac46ff4b22c4313b8b6b4c5ef (diff) | |
| download | php-git-99b5652f409e0910c6108e92ac95c435a394de72.tar.gz | |
small cleanups in MINIT code
OCIInitialize is now called at the "right" spot again
| -rw-r--r-- | ext/oci8/oci8.c | 45 | ||||
| -rw-r--r-- | ext/oci8/php_oci8.h | 2 | ||||
| -rw-r--r-- | ext/oracle/oracle.c | 29 | ||||
| -rw-r--r-- | ext/oracle/php_oracle.h | 2 | 
4 files changed, 20 insertions, 58 deletions
diff --git a/ext/oci8/oci8.c b/ext/oci8/oci8.c index d752400fec..a29124b00b 100644 --- a/ext/oci8/oci8.c +++ b/ext/oci8/oci8.c @@ -301,8 +301,7 @@ CONST void ocifree(dvoid *ctx, dvoid *ptr)  /* {{{ startup, shutdown and info functions */ -#ifdef ZTS -static void php_oci_init_globals(php_oci_globals *oci_globals) +static void php_oci_init_globals(OCILS_D)  {      	OCI(user_num)   = 1000;  	OCI(server_num) = 2000; @@ -321,32 +320,28 @@ static void php_oci_init_globals(php_oci_globals *oci_globals)  				   NULL);  } -#endif  PHP_MINIT_FUNCTION(oci)  {  	zend_class_entry oci_lob_class_entry;  	ELS_FETCH(); -#ifdef ZTS -	oci_globals_id = ts_allocate_id(sizeof(php_oci_globals), (ts_allocate_ctor) php_oci_init_globals, NULL); +#ifdef ZTS  +	#define PHP_OCI_INIT_MODE OCI_THREADED  #else -	OCI(user_num)   = 1000; -	OCI(server_num) = 2000; - -	OCI(user) = malloc(sizeof(HashTable)); -	zend_hash_init(OCI(user), 13, NULL, NULL, 1); +	#define PHP_OCI_INIT_MODE OCI_DEFAULT +#endif -	OCI(server) = malloc(sizeof(HashTable)); -	zend_hash_init(OCI(server), 13, NULL, NULL, 1);  +#if OCI_USE_EMALLOC +    OCIInitialize(PHP_OCI_INIT_MODE, NULL, ocimalloc, ocirealloc, ocifree); +#else +    OCIInitialize(PHP_OCI_INIT_MODE, NULL, NULL, NULL, NULL); +#endif -	OCIEnvInit(&OCI(pEnv), OCI_DEFAULT, 0, NULL); -	OCIHandleAlloc(OCI(pEnv),  -				   (dvoid **)&OCI(pError), -				   OCI_HTYPE_ERROR,  -				   0,  -				   NULL); -	 +#ifdef ZTS +	oci_globals_id = ts_allocate_id(sizeof(php_oci_globals), (ts_allocate_ctor) php_oci_init_globals, NULL); +#else +	php_oci_init_globals(OCILS_C);  #endif  	le_stmt = register_list_destructors(_oci_statement_dtor, NULL); @@ -393,18 +388,6 @@ PHP_MINIT_FUNCTION(oci)  	REGISTER_LONG_CONSTANT("OCI_D_LOB",OCI_DTYPE_LOB, CONST_CS | CONST_PERSISTENT);  	REGISTER_LONG_CONSTANT("OCI_D_ROWID",OCI_DTYPE_ROWID, CONST_CS | CONST_PERSISTENT); -#ifdef ZTS  -	#define PHP_OCI_INIT_MODE OCI_THREADED -#else -	#define PHP_OCI_INIT_MODE OCI_DEFAULT -#endif - -#if OCI_USE_EMALLOC -    OCIInitialize(PHP_OCI_INIT_MODE, NULL, ocimalloc, ocirealloc, ocifree); -#else -    OCIInitialize(PHP_OCI_INIT_MODE, NULL, NULL, NULL, NULL); -#endif -  	return SUCCESS;  } diff --git a/ext/oci8/php_oci8.h b/ext/oci8/php_oci8.h index 3df40bcdd0..d495aa66fa 100644 --- a/ext/oci8/php_oci8.h +++ b/ext/oci8/php_oci8.h @@ -180,7 +180,7 @@ extern php3_module_entry oci8_module_entry;  #ifdef ZTS  #define OCILS_D php_oci_globals *oci_globals -#define OCILS_DC , PSLS_D +#define OCILS_DC , OCILS_D  #define OCILS_C oci_globals  #define OCILS_CC , OCILS_C  #define OCI(v) (oci_globals->v) diff --git a/ext/oracle/oracle.c b/ext/oracle/oracle.c index 33e3715d80..60407d0e2a 100644 --- a/ext/oracle/oracle.c +++ b/ext/oracle/oracle.c @@ -254,8 +254,7 @@ static int _close_oracur(oraCursor *cur)  	return 1;  } -#ifdef ZTS -static void php_ora_init_globals(php_ora_globals *ora_globals) +static void php_ora_init_globals(ORALS_D)  {  	if (cfg_get_long("oracle.allow_persistent",  			 &ORA(allow_persistent)) @@ -278,36 +277,16 @@ static void php_ora_init_globals(php_ora_globals *ora_globals)  	ORA(conns) = malloc(sizeof(HashTable));  	zend_hash_init(ORA(conns), 13, NULL, NULL, 1);  } -#endif                                                                                                                                      +  PHP_MINIT_FUNCTION(oracle)  {  	ELS_FETCH();  #ifdef ZTS -	ora_globals_id = ts_allocate_id(sizeof(php_ora_globals), php_ora_init_globals, NULL); +	ora_globals_id = ts_allocate_id(sizeof(php_ora_globals), (ts_allocate_ctor) php_ora_init_globals, NULL);  #else -	if (cfg_get_long("oracle.allow_persistent", -			 &ORA(allow_persistent)) -		== FAILURE) { -	  ORA(allow_persistent) = -1; -	} -	if (cfg_get_long("oracle.max_persistent", -					 &ORA(max_persistent)) -	    == FAILURE) { -		ORA(max_persistent) = -1; -	} -	if (cfg_get_long("oracle.max_links", -					 &ORA(max_links)) -	    == FAILURE) { -		ORA(max_links) = -1; -	} -	 -	ORA(num_persistent) = 0; -	 - -	ORA(conns) = malloc(sizeof(HashTable)); -	zend_hash_init(ORA(conns), 13, NULL, NULL, 1); +	php_ora_init_globals(ORALS_C);  #endif  	le_cursor = register_list_destructors(_close_oracur, NULL); diff --git a/ext/oracle/php_oracle.h b/ext/oracle/php_oracle.h index 5ca0918380..724ddcc964 100644 --- a/ext/oracle/php_oracle.h +++ b/ext/oracle/php_oracle.h @@ -30,7 +30,7 @@ extern php3_module_entry oracle_module_entry;  #ifdef ZTS  #define ORALS_D php_ora_globals *ora_globals -#define ORALS_DC , PSLS_D +#define ORALS_DC , ORACLE_D  #define ORALS_C ora_globals  #define ORALS_CC , ORALS_C  #define ORA(v) (ora_globals->v)  | 
