diff options
author | Dmitry Stogov <dmitry@php.net> | 2006-06-15 18:33:09 +0000 |
---|---|---|
committer | Dmitry Stogov <dmitry@php.net> | 2006-06-15 18:33:09 +0000 |
commit | 1dbaae2795b756a3875c53da00b277f241cc04b8 (patch) | |
tree | fd516b57354eb9480e89dcd0503fa990d3cc2068 /ext/libxml/libxml.c | |
parent | c3ed91477a011e494559d6f65301ef6b2e38cd22 (diff) | |
download | php-git-1dbaae2795b756a3875c53da00b277f241cc04b8.tar.gz |
Added automatic module globals management
Diffstat (limited to 'ext/libxml/libxml.c')
-rw-r--r-- | ext/libxml/libxml.c | 31 |
1 files changed, 11 insertions, 20 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); |