diff options
Diffstat (limited to 'ext/libxml')
-rw-r--r-- | ext/libxml/libxml.c | 31 | ||||
-rw-r--r-- | ext/libxml/php_libxml.h | 6 |
2 files changed, 14 insertions, 23 deletions
diff --git a/ext/libxml/libxml.c b/ext/libxml/libxml.c index b2d55c6122..b2df304008 100644 --- a/ext/libxml/libxml.c +++ b/ext/libxml/libxml.c @@ -60,11 +60,8 @@ typedef struct _php_libxml_func_handler { static HashTable php_libxml_exports; -#ifdef ZTS -int libxml_globals_id; -#else -PHP_LIBXML_API php_libxml_globals libxml_globals; -#endif +ZEND_DECLARE_MODULE_GLOBALS(libxml) +static PHP_GINIT_FUNCTION(libxml); zend_class_entry *libxmlerror_class_entry; @@ -106,7 +103,11 @@ zend_module_entry libxml_module_entry = { PHP_RSHUTDOWN(libxml), /* per-request shutdown function */ PHP_MINFO(libxml), /* information function */ NO_VERSION_YET, - STANDARD_MODULE_PROPERTIES + PHP_MODULE_GLOBALS(libxml), /* globals descriptor */ + PHP_GINIT(libxml), /* globals ctor */ + NULL, /* globals dtor */ + NULL, /* post deactivate */ + STANDARD_MODULE_PROPERTIES_EX }; /* }}} */ @@ -237,14 +238,12 @@ static void php_libxml_node_free_list(xmlNodePtr node TSRMLS_DC) /* }}} */ /* {{{ startup, shutdown and info functions */ -#ifdef ZTS -static void php_libxml_init_globals(php_libxml_globals *libxml_globals_p TSRMLS_DC) +static PHP_GINIT_FUNCTION(libxml) { - LIBXML(stream_context) = NULL; - LIBXML(error_buffer).c = NULL; - LIBXML(error_list) = NULL; + libxml_globals->stream_context = NULL; + libxml_globals->error_buffer.c = NULL; + libxml_globals->error_list = NULL; } -#endif /* Channel libxml file io layer through the PHP streams subsystem. * This allows use of ftps:// and https:// urls */ @@ -575,14 +574,6 @@ PHP_MINIT_FUNCTION(libxml) php_libxml_initialize(); -#ifdef ZTS - ts_allocate_id(&libxml_globals_id, sizeof(php_libxml_globals), (ts_allocate_ctor) php_libxml_init_globals, NULL); -#else - LIBXML(stream_context) = NULL; - LIBXML(error_buffer).c = NULL; - LIBXML(error_list) = NULL; -#endif - REGISTER_LONG_CONSTANT("LIBXML_VERSION", LIBXML_VERSION, CONST_CS | CONST_PERSISTENT); REGISTER_STRING_CONSTANT("LIBXML_DOTTED_VERSION", LIBXML_DOTTED_VERSION, CONST_CS | CONST_PERSISTENT); diff --git a/ext/libxml/php_libxml.h b/ext/libxml/php_libxml.h index afc538e847..badbd6bec8 100644 --- a/ext/libxml/php_libxml.h +++ b/ext/libxml/php_libxml.h @@ -37,11 +37,11 @@ extern zend_module_entry libxml_module_entry; #define LIBXML_SAVE_NOEMPTYTAG 1<<2 -typedef struct { +ZEND_BEGIN_MODULE_GLOBALS(libxml) zval *stream_context; smart_str error_buffer; zend_llist *error_list; -} php_libxml_globals; +ZEND_END_MODULE_GLOBALS(libxml) typedef struct _libxml_doc_props { int formatoutput; @@ -103,7 +103,7 @@ PHP_LIBXML_API void php_libxml_initialize(); PHP_LIBXML_API void php_libxml_shutdown(); #ifdef ZTS -#define LIBXML(v) TSRMG(libxml_globals_id, php_libxml_globals *, v) +#define LIBXML(v) TSRMG(libxml_globals_id, zend_libxml_globals *, v) #else #define LIBXML(v) (libxml_globals.v) #endif |