cvs: Zend / zend_globals.h zend_ini.c

From: Date: Mon, 23 Sep 2002 12:00:42 +0000
Subject: cvs: Zend / zend_globals.h zend_ini.c
Groups: php.zend-engine.cvs 
Request: Send a blank email to php-zend-engine-cvs+get-446@lists.php.net to get a copy of this message
zeev Mon Sep 23 08:00:42 2002 EDT Modified files: /Zend zend_globals.h zend_ini.c Log: Thread safety fix - thanks again to Michael Sisolak for pointing out the problem Index: Zend/zend_globals.h diff -u Zend/zend_globals.h:1.90 Zend/zend_globals.h:1.91 --- Zend/zend_globals.h:1.90 Tue Sep 3 10:42:04 2002 +++ Zend/zend_globals.h Mon Sep 23 08:00:38 2002 @@ -205,7 +205,7 @@ int lambda_count; - HashTable ini_directives; + HashTable *ini_directives; void *reserved[ZEND_MAX_RESERVED_RESOURCES]; }; Index: Zend/zend_ini.c diff -u Zend/zend_ini.c:1.22 Zend/zend_ini.c:1.23 --- Zend/zend_ini.c:1.22 Thu Sep 19 18:24:46 2002 +++ Zend/zend_ini.c Mon Sep 23 08:00:39 2002 @@ -65,7 +65,9 @@ */ ZEND_API int zend_ini_startup(TSRMLS_D) { - registered_zend_ini_directives = &EG(ini_directives); + registered_zend_ini_directives = (HashTable *) malloc(sizeof(HashTable)); + + EG(ini_directives) = registered_zend_ini_directives; if (zend_hash_init_ex(registered_zend_ini_directives, 100, NULL, NULL, 1, 0)==FAILURE) { return FAILURE; } @@ -75,29 +77,32 @@ ZEND_API int zend_ini_shutdown(TSRMLS_D) { - zend_hash_destroy(&EG(ini_directives)); + zend_hash_destroy(EG(ini_directives)); return SUCCESS; } ZEND_API int zend_ini_deactivate(TSRMLS_D) { - zend_hash_apply_with_argument(&EG(ini_directives), (apply_func_arg_t) zend_restore_ini_entry_cb, (void *) ZEND_INI_STAGE_DEACTIVATE TSRMLS_CC); + zend_hash_apply_with_argument(EG(ini_directives), (apply_func_arg_t) zend_restore_ini_entry_cb, (void *) ZEND_INI_STAGE_DEACTIVATE TSRMLS_CC); return SUCCESS; } +#ifdef ZTS ZEND_API int zend_copy_ini_directives(TSRMLS_D) { zend_ini_entry ini_entry; - if (zend_hash_init_ex(&EG(ini_directives), registered_zend_ini_directives->nNumOfElements, NULL, NULL, 1, 0)==FAILURE) { + EG(ini_directives) = (HashTable *) malloc(sizeof(HashTable)); + if (zend_hash_init_ex(EG(ini_directives), registered_zend_ini_directives->nNumOfElements, NULL, NULL, 1, 0)==FAILURE) { return FAILURE; } - zend_hash_copy(&EG(ini_directives), registered_zend_ini_directives, NULL, &ini_entry, sizeof(zend_ini_entry)); + zend_hash_copy(EG(ini_directives), registered_zend_ini_directives, NULL, &ini_entry, sizeof(zend_ini_entry)); zend_ini_refresh_caches(ZEND_INI_STAGE_STARTUP TSRMLS_CC); return SUCCESS; } +#endif static int ini_key_compare(const void *a, const void *b TSRMLS_DC) @@ -122,7 +127,7 @@ ZEND_API void zend_ini_sort_entries(TSRMLS_D) { - zend_hash_sort(&EG(ini_directives), zend_qsort, ini_key_compare, 0 TSRMLS_CC); + zend_hash_sort(EG(ini_directives), zend_qsort, ini_key_compare, 0 TSRMLS_CC); } /* @@ -175,7 +180,7 @@ ZEND_API void zend_ini_refresh_caches(int stage TSRMLS_DC) { - zend_hash_apply_with_argument(&EG(ini_directives), (apply_func_arg_t) zend_ini_refresh_cache, (void *)(long) stage TSRMLS_CC); + zend_hash_apply_with_argument(EG(ini_directives), (apply_func_arg_t) zend_ini_refresh_cache, (void *)(long) stage TSRMLS_CC); } @@ -185,7 +190,7 @@ char *duplicate; TSRMLS_FETCH(); - if (zend_hash_find(&EG(ini_directives), name, name_length, (void **) &ini_entry)==FAILURE) { + if (zend_hash_find(EG(ini_directives), name, name_length, (void **) &ini_entry)==FAILURE) { return FAILURE; } @@ -219,7 +224,7 @@ zend_ini_entry *ini_entry; TSRMLS_FETCH(); - if (zend_hash_find(&EG(ini_directives), name, name_length, (void **) &ini_entry)==FAILURE) { + if (zend_hash_find(EG(ini_directives), name, name_length, (void **) &ini_entry)==FAILURE) { return FAILURE; } @@ -251,7 +256,7 @@ zend_ini_entry *ini_entry; TSRMLS_FETCH(); - if (zend_hash_find(&EG(ini_directives), name, name_length, (void **) &ini_entry)==SUCCESS) { + if (zend_hash_find(EG(ini_directives), name, name_length, (void **) &ini_entry)==SUCCESS) { if (orig && ini_entry->modified) { return (ini_entry->orig_value ? strtol(ini_entry->orig_value, NULL, 0) : 0); } else if (ini_entry->value) { @@ -268,7 +273,7 @@ zend_ini_entry *ini_entry; TSRMLS_FETCH(); - if (zend_hash_find(&EG(ini_directives), name, name_length, (void **) &ini_entry)==SUCCESS) { + if (zend_hash_find(EG(ini_directives), name, name_length, (void **) &ini_entry)==SUCCESS) { if (orig && ini_entry->modified) { return (double) (ini_entry->orig_value ? strtod(ini_entry->orig_value, NULL) : 0.0); } else if (ini_entry->value) { @@ -285,7 +290,7 @@ zend_ini_entry *ini_entry; TSRMLS_FETCH(); - if (zend_hash_find(&EG(ini_directives), name, name_length, (void **) &ini_entry)==SUCCESS) { + if (zend_hash_find(EG(ini_directives), name, name_length, (void **) &ini_entry)==SUCCESS) { if (orig && ini_entry->modified) { return ini_entry->orig_value; } else {

« previous php.zend-engine.cvs (#446) next »