diff options
Diffstat (limited to 'main/php_virtual_cwd.c')
| -rw-r--r-- | main/php_virtual_cwd.c | 14 |
1 files changed, 5 insertions, 9 deletions
diff --git a/main/php_virtual_cwd.c b/main/php_virtual_cwd.c index 4bddd400fa..efb0ac8cf8 100644 --- a/main/php_virtual_cwd.c +++ b/main/php_virtual_cwd.c @@ -11,11 +11,10 @@ #ifdef ZTS #include "TSRM.h" -CWD_API int cwd_globals_id; -#else -cwd_globals_struct cwd_globals; #endif +ZEND_DECLARE_MODULE_GLOBALS(cwd); + cwd_state true_global_cwd_state; #ifndef ZEND_WIN32 @@ -110,7 +109,7 @@ static int php_is_file_ok(const cwd_state *state) return (1); } -static void cwd_globals_ctor(cwd_globals_struct *cwd_globals) +static void cwd_globals_ctor(zend_cwd_globals *cwd_globals) { cwd_globals->cwd.cwd = (char *) malloc(true_global_cwd_state.cwd_length+1); memcpy(cwd_globals->cwd.cwd, true_global_cwd_state.cwd, true_global_cwd_state.cwd_length+1); @@ -128,11 +127,8 @@ void virtual_cwd_startup() } true_global_cwd_state.cwd = strdup(cwd); true_global_cwd_state.cwd_length = strlen(cwd); -#ifdef ZTS - cwd_globals_id = ts_allocate_id(sizeof(cwd_globals_struct), (ts_allocate_ctor) cwd_globals_ctor, NULL); -#else - cwd_globals_ctor(&cwd_globals); -#endif + + ZEND_INIT_MODULE_GLOBALS(cwd, cwd_globals_ctor, NULL); } char *virtual_getcwd_ex(int *length) |
