diff options
| author | Dmitry Stogov <dmitry@php.net> | 2006-06-13 13:11:42 +0000 |
|---|---|---|
| committer | Dmitry Stogov <dmitry@php.net> | 2006-06-13 13:11:42 +0000 |
| commit | 2cbde06400d2caf58d7f789b828f8d663980c8d2 (patch) | |
| tree | cc048ac8c07753e6f53d1de9e1a874efcf1999bd /Zend/zend_API.c | |
| parent | 08e355e39eea5b310dc2f723a8d8662a2069562e (diff) | |
| download | php-git-2cbde06400d2caf58d7f789b828f8d663980c8d2.tar.gz | |
Added automatic module globals management.
Diffstat (limited to 'Zend/zend_API.c')
| -rw-r--r-- | Zend/zend_API.c | 24 |
1 files changed, 24 insertions, 0 deletions
diff --git a/Zend/zend_API.c b/Zend/zend_API.c index 9fc948fda8..06a6bfd004 100644 --- a/Zend/zend_API.c +++ b/Zend/zend_API.c @@ -1873,6 +1873,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) { @@ -2323,6 +2334,19 @@ 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); |
