summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRasmus Lerdorf <rasmus@php.net>2001-08-10 09:48:48 +0000
committerRasmus Lerdorf <rasmus@php.net>2001-08-10 09:48:48 +0000
commit05db76df86c5f4e44676a052720c7d05a490346f (patch)
tree361a568044a00a6e263e319d5cf0fb4aa01dec62
parenteee9187ecb6b54a3984c40653df63885d682b0be (diff)
downloadphp-git-05db76df86c5f4e44676a052720c7d05a490346f.tar.gz
Sablot extension cleanup - it compiles again now
-rw-r--r--ext/sablot/php_sablot.h2
-rw-r--r--ext/sablot/sablot.c21
-rw-r--r--main/php.h24
3 files changed, 35 insertions, 12 deletions
diff --git a/ext/sablot/php_sablot.h b/ext/sablot/php_sablot.h
index 38f3dc0ef7..f912944ac6 100644
--- a/ext/sablot/php_sablot.h
+++ b/ext/sablot/php_sablot.h
@@ -108,7 +108,7 @@ typedef struct {
/* Sablotron Globals */
-typedef struct {
+typedef struct _php_sablot_globals {
zval *errorHandler;
php_sablot_error *errors;
php_sablot_error errors_start;
diff --git a/ext/sablot/sablot.c b/ext/sablot/sablot.c
index 6547f9050e..268202f053 100644
--- a/ext/sablot/sablot.c
+++ b/ext/sablot/sablot.c
@@ -166,12 +166,7 @@ static SchemeHandler sh = {
_php_sablot_sh_close
};
-#ifdef ZTS
-int sablot_globals_id;
-#else
-php_sablot_globals sablot_globals;
-#endif
-
+PHP_DECLARE_MODULE_GLOBALS(sablot)
static unsigned char sixth_arg_force_ref[] = { 6, BYREF_NONE, BYREF_NONE, BYREF_NONE, BYREF_NONE, BYREF_NONE, BYREF_FORCE };
static unsigned char third_arg_force_ref[] = { 4, BYREF_NONE, BYREF_NONE, BYREF_FORCE, BYREF_NONE };
@@ -214,12 +209,12 @@ zend_module_entry sablot_module_entry = {
ZEND_GET_MODULE(sablot)
#endif
-static void php_sablot_init_globals(php_sablot_init_globals *sablot_init_globals_p TSRMLS_DC)
+static void php_sablot_init_globals(php_sablot_globals *sablot_globals)
{
- SABLOTG(processor) = NULL;
- SABLOTG(errors) = NULL;
- SABLOTG(errorHandler) = NULL;
- SABLOTG(output_transform_file) = NULL;
+ sablot_globals->processor = NULL;
+ sablot_globals->errors = NULL;
+ sablot_globals->errorHandler = NULL;
+ sablot_globals->output_transform_file = NULL;
}
@@ -248,7 +243,9 @@ PHP_MSHUTDOWN_FUNCTION(sablot)
PHP_RSHUTDOWN_FUNCTION(sablot)
{
+ /*
SABLOT_FREE_ERROR_HANDLE(SABLOTG_HANDLE);
+ */
return SUCCESS;
}
@@ -1349,7 +1346,9 @@ static MH_ERROR _php_sablot_error(void *userData, SablotHandle p, MH_ERROR code,
TSRMLS_FETCH();
if (userData == NULL) {
+ /* **FIXME** SABLOTG_HANDLE is not defined anywhere -RL
SABLOT_FREE_ERROR_HANDLE(SABLOTG_HANDLE);
+ */
SABLOTG(errors_start).next = NULL;
SABLOTG(errors) = &SABLOTG(errors_start);
diff --git a/main/php.h b/main/php.h
index fb2f62f666..356be3dd51 100644
--- a/main/php.h
+++ b/main/php.h
@@ -228,6 +228,30 @@ char *strerror(int);
#define PHP_RSHUTDOWN_FUNCTION(module) int PHP_RSHUTDOWN(module)(SHUTDOWN_FUNC_ARGS)
#define PHP_MINFO_FUNCTION(module) void PHP_MINFO(module)(ZEND_MODULE_INFO_FUNC_ARGS)
+#define PHP_BEGIN_MODULE_GLOBALS(module_name) \
+ typedef struct _php_##module_name##_globals {
+#define PHP_END_MODULE_GLOBALS(module_name) \
+ } php_##module_name##_globals;
+
+#ifdef ZTS
+
+#define PHP_DECLARE_MODULE_GLOBALS(module_name) \
+ ts_rsrc_id module_name##_globals_id;
+#define PHP_EXTERN_MODULE_GLOBALS(module_name) \
+ extern ts_rsrc_id module_name##_globals_id;
+#define PHP_INIT_MODULE_GLOBALS(module_name, globals_ctor, globals_dtor) \
+ ts_allocate_id(&module_name##_globals_id, sizeof(php_##module_name##_globals), (ts_allocate_ctor) globals_ctor, (ts_allocate_dtor) globals_dtor);
+
+#else
+
+#define PHP_DECLARE_MODULE_GLOBALS(module_name) \
+ php_##module_name##_globals module_name##_globals;
+#define PHP_EXTERN_MODULE_GLOBALS(module_name) \
+ extern php_##module_name##_globals module_name##_globals;
+#define PHP_INIT_MODULE_GLOBALS(module_name, globals_ctor, globals_dtor) \
+ globals_ctor(&module_name##_globals);
+
+#endif
/* global variables */
extern pval *data;