summaryrefslogtreecommitdiff
path: root/Zend/zend_API.c
diff options
context:
space:
mode:
authorDmitry Stogov <dmitry@php.net>2006-06-15 14:03:21 +0000
committerDmitry Stogov <dmitry@php.net>2006-06-15 14:03:21 +0000
commitada4e506a7b04bf6e89d5266a12d7e251fe68f20 (patch)
tree713e0610d6b9dbd1967dcff981301498a3f53d07 /Zend/zend_API.c
parentd3c3a54b4e4aeb1fdad0cb8da6ef1a9ea0ad71ee (diff)
downloadphp-git-ada4e506a7b04bf6e89d5266a12d7e251fe68f20.tar.gz
MFH: Added automatic module globals management.
Diffstat (limited to 'Zend/zend_API.c')
-rw-r--r--Zend/zend_API.c23
1 files changed, 23 insertions, 0 deletions
diff --git a/Zend/zend_API.c b/Zend/zend_API.c
index 57892f3b99..6d7ef7f82b 100644
--- a/Zend/zend_API.c
+++ b/Zend/zend_API.c
@@ -1448,6 +1448,17 @@ ZEND_API int zend_startup_module_ex(zend_module_entry *module TSRMLS_DC)
}
}
+ /* Initialize module globals */
+ if (module->globals_size) {
+#ifdef ZTS
+ ts_allocate_id(module->globals_id_ptr, module->globals_size, (ts_allocate_ctor) module->globals_ctor, (ts_allocate_dtor) module->globals_dtor);
+#else
+ if (module->globals_ctor) {
+ module->globals_ctor(module->globals_ptr TSRMLS_CC);
+ }
+#endif
+ }
+
if (module->module_startup_func) {
EG(current_module) = module;
if (module->module_startup_func(module->type, module->module_number TSRMLS_CC)==FAILURE) {
@@ -1881,6 +1892,18 @@ void module_destructor(zend_module_entry *module)
#endif
module->module_shutdown_func(module->type, module->module_number TSRMLS_CC);
}
+
+ /* Deinitilaise module globals */
+ if (module->globals_size) {
+#ifdef ZTS
+ ts_free_id(*module->globals_id_ptr);
+#else
+ if (module->globals_dtor) {
+ module->globals_dtor(module->globals_ptr TSRMLS_CC);
+ }
+#endif
+ }
+
module->module_started=0;
if (module->functions) {
zend_unregister_functions(module->functions, -1, NULL TSRMLS_CC);