cvs: php4 /main php_virtual_cwd.c php_virtual_cwd.h

From: Date: Sat, 02 Sep 2000 18:40:41 +0000
Subject: cvs: php4 /main php_virtual_cwd.c php_virtual_cwd.h
Groups: php.cvs 
Request: Send a blank email to php-cvs+get-1505@lists.php.net to get a copy of this message
andi Sat Sep 2 11:40:41 2000 EDT Modified files: /php4/main php_virtual_cwd.c php_virtual_cwd.h Log: - Remove another TSRM->Zend dependency Index: php4/main/php_virtual_cwd.c diff -u php4/main/php_virtual_cwd.c:1.74 php4/main/php_virtual_cwd.c:1.75 --- php4/main/php_virtual_cwd.c:1.74 Sat Sep 2 09:08:24 2000 +++ php4/main/php_virtual_cwd.c Sat Sep 2 11:40:41 2000 @@ -17,7 +17,7 @@ +----------------------------------------------------------------------+ */ -/* $Id: php_virtual_cwd.c,v 1.74 2000/09/02 16:08:24 andi Exp $ */ +/* $Id: php_virtual_cwd.c,v 1.75 2000/09/02 18:40:41 andi Exp $ */ #include <sys/types.h> #include <sys/stat.h> @@ -48,7 +48,11 @@ MUTEX_T cwd_mutex; #endif -ZEND_DECLARE_MODULE_GLOBALS(cwd); +#ifdef ZTS +static ts_rsrc_id cwd_globals_id; +#else +static virtual_cwd_globals cwd_globals; +#endif cwd_state main_cwd_state; /* True global */ @@ -145,12 +149,12 @@ return (1); } -static void cwd_globals_ctor(zend_cwd_globals *cwd_globals) +static void cwd_globals_ctor(virtual_cwd_globals *cwd_globals) { CWD_STATE_COPY(&cwd_globals->cwd, &main_cwd_state); } -static void cwd_globals_dtor(zend_cwd_globals *cwd_globals) +static void cwd_globals_dtor(virtual_cwd_globals *cwd_globals) { CWD_STATE_FREE(&cwd_globals->cwd); } @@ -166,8 +170,13 @@ } main_cwd_state.cwd = strdup(cwd); main_cwd_state.cwd_length = strlen(cwd); + +#ifdef ZTS + cwd_globals_id = ts_allocate_id(sizeof(virtual_cwd_globals), (ts_allocate_ctor) cwd_globals_ctor, (ts_allocate_dtor) cwd_globals_dtor); +#else + cwd_globals_ctor(&cwd_globals); +#endif - ZEND_INIT_MODULE_GLOBALS(cwd, cwd_globals_ctor, cwd_globals_dtor); #if defined(ZEND_WIN32) && defined(ZTS) cwd_mutex = tsrm_mutex_alloc(); #endif Index: php4/main/php_virtual_cwd.h diff -u php4/main/php_virtual_cwd.h:1.38 php4/main/php_virtual_cwd.h:1.39 --- php4/main/php_virtual_cwd.h:1.38 Sun Aug 27 12:36:35 2000 +++ php4/main/php_virtual_cwd.h Sat Sep 2 11:40:41 2000 @@ -17,7 +17,7 @@ +----------------------------------------------------------------------+ */ -/* $Id: php_virtual_cwd.h,v 1.38 2000/08/27 19:36:35 sas Exp $ */ +/* $Id: php_virtual_cwd.h,v 1.39 2000/09/02 18:40:41 andi Exp $ */ #ifndef VIRTUAL_CWD_H #define VIRTUAL_CWD_H @@ -118,17 +118,17 @@ CWD_API int virtual_file_ex(cwd_state *state, const char *path, verify_path_func verify_path); -ZEND_BEGIN_MODULE_GLOBALS(cwd) +typedef struct _virtual_cwd_globals { cwd_state cwd; -ZEND_END_MODULE_GLOBALS(cwd) +} virtual_cwd_globals; #ifdef ZTS -# define CWDLS_D zend_cwd_globals *cwd_globals +# define CWDLS_D virtual_cwd_globals *cwd_globals # define CWDLS_DC , CWDLS_D # define CWDLS_C cwd_globals # define CWDLS_CC , CWDLS_C # define CWDG(v) (cwd_globals->v) -# define CWDLS_FETCH() zend_cwd_globals *cwd_globals = ts_resource(cwd_globals_id) +# define CWDLS_FETCH() virtual_cwd_globals *cwd_globals = ts_resource(cwd_globals_id) #else # define CWDLS_D void # define CWDLS_DC

« previous php.cvs (#1505) next »