cvs: /php4 SAPI.c php_virtual_cwd.c php_virtual_cwd.h

From: Date: Sun, 02 Apr 2000 20:26:36 +0000
Subject: cvs: /php4 SAPI.c php_virtual_cwd.c php_virtual_cwd.h
Groups: php.version4 
Request: Send a blank email to php-version4+get-13017@lists.php.net to get a copy of this message
andi Sun Apr 2 13:26:36 2000 EDT Modified files: /php4 SAPI.c php_virtual_cwd.c php_virtual_cwd.h Log: - Create dtor function Index: php4/SAPI.c diff -u php4/SAPI.c:1.70 php4/SAPI.c:1.71 --- php4/SAPI.c:1.70 Sun Apr 2 12:04:59 2000 +++ php4/SAPI.c Sun Apr 2 13:26:06 2000 @@ -92,6 +92,9 @@ SAPI_API void sapi_shutdown(void) { reentrancy_shutdown(); +#ifdef VIRTUAL_DIR + virtual_cwd_shutdown(); +#endif php_global_shutdown_internal_extensions(); zend_hash_destroy(&known_post_content_types); } Index: php4/php_virtual_cwd.c diff -u php4/php_virtual_cwd.c:1.23 php4/php_virtual_cwd.c:1.24 --- php4/php_virtual_cwd.c:1.23 Sun Apr 2 12:45:02 2000 +++ php4/php_virtual_cwd.c Sun Apr 2 13:26:06 2000 @@ -123,6 +123,11 @@ CWD_STATE_COPY(&cwd_globals->cwd, &main_cwd_state); } +static void cwd_globals_dtor(zend_cwd_globals *cwd_globals) +{ + CWD_STATE_FREE(&cwd_globals->cwd); +} + void virtual_cwd_startup() { char cwd[1024]; /* Should probably use system define here */ @@ -135,7 +140,15 @@ main_cwd_state.cwd = strdup(cwd); main_cwd_state.cwd_length = strlen(cwd); - ZEND_INIT_MODULE_GLOBALS(cwd, cwd_globals_ctor, NULL); + ZEND_INIT_MODULE_GLOBALS(cwd, cwd_globals_ctor, cwd_globals_dtor); +} + +void virtual_cwd_shutdown() +{ +#ifndef ZTS + cwd_globals_dtor(&cwd_globals); +#endif + free(main_cwd_state.cwd); /* Don't use CWD_STATE_FREE because the non global states will probably use emalloc()/efree() */ } char *virtual_getcwd_ex(int *length) @@ -291,7 +304,7 @@ int length = strlen(path); if (length == 0) { - return 1; /* Can't CD to empty string */ + return 1; /* Can't cd to empty string */ } while(--length >= 0 && !IS_SLASH(path[length])) { } Index: php4/php_virtual_cwd.h diff -u php4/php_virtual_cwd.h:1.7 php4/php_virtual_cwd.h:1.8 --- php4/php_virtual_cwd.h:1.7 Sun Apr 2 12:45:02 2000 +++ php4/php_virtual_cwd.h Sun Apr 2 13:26:06 2000 @@ -22,6 +22,7 @@ typedef int (*verify_path_func)(const cwd_state *); void virtual_cwd_startup(); +void virtual_cwd_shutdown(); char *virtual_getcwd_ex(int *length); char *virtual_getcwd(char *buf, size_t size); int virtual_chdir(char *path);

« previous php.version4 (#13017) next »