cvs: /php4 php_virtual_cwd.c php_virtual_cwd.h
| From: | Andi Gutmans | Date: | Sat, 01 Apr 2000 20:11:31 +0000 |
| Subject: | cvs: /php4 php_virtual_cwd.c php_virtual_cwd.h | ||
| Groups: | php.version4 | ||
| Request: | Send a blank email to php-version4+get-13001@lists.php.net to get a copy of this message | ||
andi Sat Apr 1 12:11:31 2000 EDT
Modified files:
/php4 php_virtual_cwd.c php_virtual_cwd.h
Log:
- Move to new Zend macros
Index: php4/php_virtual_cwd.c
diff -u php4/php_virtual_cwd.c:1.19 php4/php_virtual_cwd.c:1.20
--- php4/php_virtual_cwd.c:1.19 Sat Apr 1 10:22:46 2000
+++ php4/php_virtual_cwd.c Sat Apr 1 12:11:01 2000
@@ -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 @@
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 @@
}
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)
Index: php4/php_virtual_cwd.h
diff -u php4/php_virtual_cwd.h:1.5 php4/php_virtual_cwd.h:1.6
--- php4/php_virtual_cwd.h:1.5 Sat Apr 1 10:22:46 2000
+++ php4/php_virtual_cwd.h Sat Apr 1 12:11:01 2000
@@ -2,6 +2,7 @@
#define VIRTUAL_CWD_H
#include "zend.h"
+#include "zend_API.h"
#ifdef ZEND_WIN32
# ifdef CWD_EXPORTS
@@ -27,17 +28,17 @@
int virtual_filepath(char *path, char **filepath);
FILE *virtual_fopen(char *path, const char *mode);
-typedef struct _cwd_globals_struct {
+ZEND_BEGIN_MODULE_GLOBALS(cwd)
cwd_state cwd;
-} cwd_globals_struct;
+ZEND_END_MODULE_GLOBALS(cwd)
#ifdef ZTS
-# define CWDLS_D cwd_globals_struct *cwd_globals
+# define CWDLS_D zend_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() cwd_globals_struct *cwd_globals = ts_resource(cwd_globals_id)
+# define CWDLS_FETCH() zend_cwd_globals *cwd_globals = ts_resource(cwd_globals_id)
CWD_API extern int cwd_globals_id;
#else
# define CWDLS_D void
@@ -46,7 +47,7 @@
# define CWDLS_CC
# define CWDG(v) (cwd_globals.v)
# define CWDLS_FETCH()
-extern CWD_API cwd_globals_struct cwd_globals;
+extern CWD_API zend_cwd_globals cwd_globals;
#endif
#endif /* VIRTUAL_CWD_H */