summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--ext/bcmath/bcmath.c13
-rw-r--r--ext/com_dotnet/com_extension.c13
-rw-r--r--ext/date/php_date.c12
-rw-r--r--ext/dba/dba.c39
-rw-r--r--ext/exif/exif.c13
-rw-r--r--ext/fbsql/php_fbsql.c15
-rw-r--r--ext/fdf/fdf.c15
-rw-r--r--ext/gmp/gmp.c17
-rw-r--r--ext/iconv/iconv.c30
-rw-r--r--ext/imap/php_imap.c16
-rw-r--r--ext/interbase/interbase.c15
-rw-r--r--ext/ldap/ldap.c13
-rw-r--r--ext/libxml/libxml.c31
-rw-r--r--ext/libxml/php_libxml.h6
-rw-r--r--ext/mbstring/mbstring.c39
-rw-r--r--ext/mcrypt/mcrypt.c15
-rw-r--r--ext/mime_magic/mime_magic.c15
-rw-r--r--ext/mssql/php_mssql.c17
-rw-r--r--ext/mysql/php_mysql.c17
-rw-r--r--ext/mysqli/mysqli.c13
-rw-r--r--ext/oci8/oci8.c12
-rw-r--r--ext/odbc/php_odbc.c45
-rw-r--r--ext/odbc/php_odbc_includes.h6
-rwxr-xr-xext/pcntl/pcntl.c10
-rw-r--r--ext/pcre/php_pcre.c18
-rwxr-xr-xext/pdo/pdo.c12
-rw-r--r--ext/pdo_dblib/pdo_dblib.c16
-rw-r--r--ext/pgsql/pgsql.c17
-rw-r--r--ext/posix/posix.c14
-rw-r--r--ext/recode/recode.c13
-rw-r--r--ext/session/session.c18
-rw-r--r--ext/skeleton/skeleton.c1
-rw-r--r--ext/snmp/snmp.c13
-rw-r--r--ext/sockets/sockets.c11
-rwxr-xr-xext/spl/php_spl.c12
-rw-r--r--ext/sqlite/sqlite.c16
-rw-r--r--ext/sybase_ct/php_sybase_ct.c30
-rw-r--r--ext/tidy/tidy.c23
-rw-r--r--ext/tokenizer/tokenizer.c5
-rw-r--r--ext/xml/php_xml.h6
-rw-r--r--ext/xml/xml.c25
-rw-r--r--ext/zlib/zlib.c22
42 files changed, 375 insertions, 334 deletions
diff --git a/ext/bcmath/bcmath.c b/ext/bcmath/bcmath.c
index 1acd12e934..05bfb06642 100644
--- a/ext/bcmath/bcmath.c
+++ b/ext/bcmath/bcmath.c
@@ -32,6 +32,7 @@
#include "libbcmath/src/bcmath.h"
ZEND_DECLARE_MODULE_GLOBALS(bcmath);
+static PHP_GINIT_FUNCTION(bcmath);
/* {{{ arginfo */
static
@@ -127,7 +128,11 @@ zend_module_entry bcmath_module_entry = {
PHP_RSHUTDOWN(bcmath),
PHP_MINFO(bcmath),
NO_VERSION_YET,
- STANDARD_MODULE_PROPERTIES
+ PHP_MODULE_GLOBALS(bcmath),
+ PHP_GINIT(bcmath),
+ NULL,
+ NULL,
+ STANDARD_MODULE_PROPERTIES_EX
};
#ifdef COMPILE_DL_BCMATH
@@ -140,9 +145,9 @@ PHP_INI_BEGIN()
PHP_INI_END()
/* }}} */
-/* {{{ php_bcmath_init_globals
+/* {{{ PHP_GINIT_FUNCTION
*/
-static void php_bcmath_init_globals(zend_bcmath_globals *bcmath_globals)
+static PHP_GINIT_FUNCTION(bcmath)
{
bcmath_globals->bc_precision = 0;
}
@@ -152,8 +157,6 @@ static void php_bcmath_init_globals(zend_bcmath_globals *bcmath_globals)
*/
PHP_MINIT_FUNCTION(bcmath)
{
- ZEND_INIT_MODULE_GLOBALS(bcmath, php_bcmath_init_globals, NULL);
-
REGISTER_INI_ENTRIES();
return SUCCESS;
diff --git a/ext/com_dotnet/com_extension.c b/ext/com_dotnet/com_extension.c
index 93ef530394..3c73ec594e 100644
--- a/ext/com_dotnet/com_extension.c
+++ b/ext/com_dotnet/com_extension.c
@@ -30,6 +30,8 @@
#include "Zend/zend_exceptions.h"
ZEND_DECLARE_MODULE_GLOBALS(com_dotnet)
+static PHP_GINIT_FUNCTION(com_dotnet);
+
TsHashTable php_com_typelibraries;
zend_class_entry
@@ -86,7 +88,11 @@ zend_module_entry com_dotnet_module_entry = {
PHP_RSHUTDOWN(com_dotnet),
PHP_MINFO(com_dotnet),
"0.1",
- STANDARD_MODULE_PROPERTIES
+ PHP_MODULE_GLOBALS(com_dotnet),
+ PHP_GINIT(com_dotnet),
+ NULL,
+ NULL,
+ STANDARD_MODULE_PROPERTIES_EX
};
/* }}} */
@@ -170,9 +176,9 @@ PHP_INI_BEGIN()
PHP_INI_END()
/* }}} */
-/* {{{ php_com_dotnet_init_globals
+/* {{{ PHP_GINIT_FUNCTION
*/
-static void php_com_dotnet_init_globals(zend_com_dotnet_globals *com_dotnet_globals)
+static PHP_GINIT_FUNCTION(com_dotnet)
{
memset(com_dotnet_globals, 0, sizeof(*com_dotnet_globals));
com_dotnet_globals->code_page = CP_ACP;
@@ -185,7 +191,6 @@ PHP_MINIT_FUNCTION(com_dotnet)
{
zend_class_entry ce, *tmp;
- ZEND_INIT_MODULE_GLOBALS(com_dotnet, php_com_dotnet_init_globals, NULL);
REGISTER_INI_ENTRIES();
php_com_wrapper_minit(INIT_FUNC_ARGS_PASSTHRU);
diff --git a/ext/date/php_date.c b/ext/date/php_date.c
index 92249d266e..18c0f32b57 100644
--- a/ext/date/php_date.c
+++ b/ext/date/php_date.c
@@ -227,6 +227,7 @@ static char* guess_timezone(const timelib_tzdb *tzdb TSRMLS_DC);
/* }}} */
ZEND_DECLARE_MODULE_GLOBALS(date)
+static PHP_GINIT_FUNCTION(date);
/* True global */
timelib_tzdb *php_date_global_timezone_db;
@@ -305,13 +306,17 @@ zend_module_entry date_module_entry = {
PHP_RSHUTDOWN(date), /* request shutdown */
PHP_MINFO(date), /* extension info */
PHP_VERSION, /* extension version */
- STANDARD_MODULE_PROPERTIES
+ PHP_MODULE_GLOBALS(date), /* globals descriptor */
+ PHP_GINIT(date), /* globals ctor */
+ NULL, /* globals dtor */
+ NULL, /* post deactivate */
+ STANDARD_MODULE_PROPERTIES_EX
};
/* }}} */
-/* {{{ php_date_init_globals */
-static void php_date_init_globals(zend_date_globals *date_globals)
+/* {{{ PHP_GINIT_FUNCTION */
+static PHP_GINIT_FUNCTION(date)
{
date_globals->default_timezone = NULL;
date_globals->timezone = NULL;
@@ -451,7 +456,6 @@ PHP_RSHUTDOWN_FUNCTION(date)
/* {{{ PHP_MINIT_FUNCTION */
PHP_MINIT_FUNCTION(date)
{
- ZEND_INIT_MODULE_GLOBALS(date, php_date_init_globals, NULL);
REGISTER_INI_ENTRIES();
#ifdef EXPERIMENTAL_DATE_SUPPORT
date_register_classes(TSRMLS_C);
diff --git a/ext/dba/dba.c b/ext/dba/dba.c
index 7c35359534..6a603a1f7e 100644
--- a/ext/dba/dba.c
+++ b/ext/dba/dba.c
@@ -168,6 +168,21 @@ PHP_MINIT_FUNCTION(dba);
PHP_MSHUTDOWN_FUNCTION(dba);
PHP_MINFO_FUNCTION(dba);
+ZEND_BEGIN_MODULE_GLOBALS(dba)
+ char *default_handler;
+ dba_handler *default_hptr;
+ZEND_END_MODULE_GLOBALS(dba)
+
+ZEND_DECLARE_MODULE_GLOBALS(dba)
+
+#ifdef ZTS
+#define DBA_G(v) TSRMG(dba_globals_id, zend_dba_globals *, v)
+#else
+#define DBA_G(v) (dba_globals.v)
+#endif
+
+static PHP_GINIT_FUNCTION(dba);
+
zend_module_entry dba_module_entry = {
STANDARD_MODULE_HEADER,
"dba",
@@ -178,7 +193,11 @@ zend_module_entry dba_module_entry = {
NULL,
PHP_MINFO(dba),
NO_VERSION_YET,
- STANDARD_MODULE_PROPERTIES
+ PHP_MODULE_GLOBALS(dba),
+ PHP_GINIT(dba),
+ NULL,
+ NULL,
+ STANDARD_MODULE_PROPERTIES_EX
};
#ifdef COMPILE_DL_DBA
@@ -378,19 +397,6 @@ static dba_handler handler[] = {
#endif
/* cdb/cdb_make and ini are no option here */
-ZEND_BEGIN_MODULE_GLOBALS(dba)
- char *default_handler;
- dba_handler *default_hptr;
-ZEND_END_MODULE_GLOBALS(dba)
-
-ZEND_DECLARE_MODULE_GLOBALS(dba)
-
-#ifdef ZTS
-#define DBA_G(v) TSRMG(dba_globals_id, zend_dba_globals *, v)
-#else
-#define DBA_G(v) (dba_globals.v)
-#endif
-
static int le_db;
static int le_pdb;
/* }}} */
@@ -499,9 +505,9 @@ PHP_INI_BEGIN()
PHP_INI_END()
/* }}} */
-/* {{{ php_dba_init_globals
+/* {{{ PHP_GINIT_FUNCTION
*/
-static void php_dba_init_globals(zend_dba_globals *dba_globals)
+static PHP_GINIT_FUNCTION(dba)
{
dba_globals->default_handler = "";
dba_globals->default_hptr = NULL;
@@ -512,7 +518,6 @@ static void php_dba_init_globals(zend_dba_globals *dba_globals)
*/
PHP_MINIT_FUNCTION(dba)
{
- ZEND_INIT_MODULE_GLOBALS(dba, php_dba_init_globals, NULL);
REGISTER_INI_ENTRIES();
le_db = zend_register_list_destructors_ex(dba_close_rsrc, NULL, "dba", module_number);
le_pdb = zend_register_list_destructors_ex(dba_close_pe_rsrc, dba_close_rsrc, "dba persistent", module_number);
diff --git a/ext/exif/exif.c b/ext/exif/exif.c
index db91238bde..9def821682 100644
--- a/ext/exif/exif.c
+++ b/ext/exif/exif.c
@@ -206,9 +206,9 @@ PHP_INI_BEGIN()
PHP_INI_END()
/* }}} */
-/* {{{ php_extname_init_globals
+/* {{{ PHP_GINIT_FUNCTION
*/
-static void php_exif_init_globals(zend_exif_globals *exif_globals)
+static PHP_GINIT_FUNCTION(exif)
{
exif_globals->encode_unicode = NULL;
exif_globals->decode_unicode_be = NULL;
@@ -223,7 +223,6 @@ static void php_exif_init_globals(zend_exif_globals *exif_globals)
Get the size of an image as 4-element array */
PHP_MINIT_FUNCTION(exif)
{
- ZEND_INIT_MODULE_GLOBALS(exif, php_exif_init_globals, NULL);
REGISTER_INI_ENTRIES();
REGISTER_LONG_CONSTANT("EXIF_USE_MBSTRING", EXIF_USE_MBSTRING, CONST_CS | CONST_PERSISTENT);
return SUCCESS;
@@ -254,7 +253,15 @@ zend_module_entry exif_module_entry = {
#if ZEND_MODULE_API_NO >= 20010901
EXIF_VERSION,
#endif
+#if ZEND_MODULE_API_NO >= 20060613
+ PHP_MODULE_GLOBALS(exif),
+ PHP_GINIT(exif),
+ NULL,
+ NULL,
+ STANDARD_MODULE_PROPERTIES_EX
+#else
STANDARD_MODULE_PROPERTIES
+#endif
};
/* }}} */
diff --git a/ext/fbsql/php_fbsql.c b/ext/fbsql/php_fbsql.c
index 3174defd9d..e78d14bffe 100644
--- a/ext/fbsql/php_fbsql.c
+++ b/ext/fbsql/php_fbsql.c
@@ -165,6 +165,9 @@ struct PHPFBLink
#define DIGEST_BUFFER_SIZE 17 /* fbcDigestPassword() expects a preallocated buffer for 16 bytes plus termination */
+ZEND_DECLARE_MODULE_GLOBALS(fbsql)
+static PHP_GINIT_FUNCTION(fbsql);
+
int mdOk(PHPFBLink* link, FBCMetaData* md, char* sql);
char *DigestPassword(char *user, char *password)
{
@@ -620,11 +623,13 @@ zend_module_entry fbsql_module_entry = {
PHP_RSHUTDOWN(fbsql),
PHP_MINFO(fbsql),
NO_VERSION_YET,
- STANDARD_MODULE_PROPERTIES
+ PHP_MODULE_GLOBALS(fbsql),
+ PHP_GINIT(fbsql),
+ NULL,
+ NULL,
+ STANDARD_MODULE_PROPERTIES_EX
};
-ZEND_DECLARE_MODULE_GLOBALS(fbsql)
-
#ifdef COMPILE_DL_FBSQL
ZEND_GET_MODULE(fbsql)
#endif
@@ -745,7 +750,7 @@ PHP_INI_BEGIN()
PHP_INI_END()
/* }}} */
-static void php_fbsql_init_globals(zend_fbsql_globals *fbsql_globals)
+static PHP_GINIT_FUNCTION(fbsql)
{
fbsql_globals->persistentCount = 0;
@@ -763,8 +768,6 @@ static void php_fbsql_init_globals(zend_fbsql_globals *fbsql_globals)
PHP_MINIT_FUNCTION(fbsql)
{
- ZEND_INIT_MODULE_GLOBALS(fbsql, php_fbsql_init_globals, NULL);
-
REGISTER_INI_ENTRIES();
fbcInitialize();
diff --git a/ext/fdf/fdf.c b/ext/fdf/fdf.c
index 3fe953b956..252a476ad1 100644
--- a/ext/fdf/fdf.c
+++ b/ext/fdf/fdf.c
@@ -318,6 +318,9 @@ zend_function_entry fdf_functions[] = {
};
/* }}} */
+ZEND_DECLARE_MODULE_GLOBALS(fdf)
+static PHP_GINIT_FUNCTION(fdf);
+
zend_module_entry fdf_module_entry = {
STANDARD_MODULE_HEADER,
"fdf",
@@ -328,15 +331,17 @@ zend_module_entry fdf_module_entry = {
NULL,
PHP_MINFO(fdf),
NO_VERSION_YET,
- STANDARD_MODULE_PROPERTIES
+ PHP_MODULE_GLOBALS(fdf),
+ PHP_GINIT(fdf),
+ NULL,
+ NULL,
+ STANDARD_MODULE_PROPERTIES_EX
};
#ifdef COMPILE_DL_FDF
ZEND_GET_MODULE(fdf)
#endif
-ZEND_DECLARE_MODULE_GLOBALS(fdf)
-
#define FDF_SUCCESS do { FDF_G(error)=FDFErcOK; RETURN_TRUE;} while(0)
#define FDF_FAILURE(err) do { FDF_G(error)=err; RETURN_FALSE;} while(0)
@@ -356,7 +361,7 @@ static sapi_post_entry php_fdf_post_entry = {
fdf_post_handler
};
-static void php_fdf_init_globals(zend_fdf_globals *fdf_globals)
+static PHP_GINIT_FUNCTION(fdf)
{
memset(fdf_globals, 0, sizeof(*fdf_globals));
}
@@ -367,8 +372,6 @@ static void php_fdf_init_globals(zend_fdf_globals *fdf_globals)
*/
PHP_MINIT_FUNCTION(fdf)
{
- ZEND_INIT_MODULE_GLOBALS(fdf, php_fdf_init_globals, NULL);
-
le_fdf = zend_register_list_destructors_ex(phpi_FDFClose, NULL, "fdf", module_number);
/* add handler for Acrobat FDF form post requests */
diff --git a/ext/gmp/gmp.c b/ext/gmp/gmp.c
index 163c46b6fe..4a96860a1d 100644
--- a/ext/gmp/gmp.c
+++ b/ext/gmp/gmp.c
@@ -267,6 +267,9 @@ ZEND_END_ARG_INFO()
/* }}} */
+ZEND_DECLARE_MODULE_GLOBALS(gmp)
+static ZEND_GINIT_FUNCTION(gmp);
+
/* {{{ gmp_functions[]
*/
zend_function_entry gmp_functions[] = {
@@ -326,12 +329,14 @@ zend_module_entry gmp_module_entry = {
ZEND_MODULE_DEACTIVATE_N(gmp),
ZEND_MODULE_INFO_N(gmp),
NO_VERSION_YET,
- STANDARD_MODULE_PROPERTIES
+ ZEND_MODULE_GLOBALS(gmp),
+ ZEND_GINIT(gmp),
+ NULL,
+ NULL,
+ STANDARD_MODULE_PROPERTIES_EX
};
/* }}} */
-ZEND_DECLARE_MODULE_GLOBALS(gmp)
-
#ifdef COMPILE_DL_GMP
ZEND_GET_MODULE(gmp)
# ifdef PHP_WIN32
@@ -371,9 +376,9 @@ static void gmp_efree(void *ptr, size_t size)
}
/* }}} */
-/* {{{ php_gmp_init_globals
+/* {{{ ZEND_GINIT_FUNCTION
*/
-static void php_gmp_init_globals(zend_gmp_globals *gmp_globals)
+static ZEND_GINIT_FUNCTION(gmp)
{
gmp_globals->rand_initialized = 0;
}
@@ -383,8 +388,6 @@ static void php_gmp_init_globals(zend_gmp_globals *gmp_globals)
*/
ZEND_MODULE_STARTUP_D(gmp)
{
- ZEND_INIT_MODULE_GLOBALS(gmp, php_gmp_init_globals, NULL);
-
le_gmp = zend_register_list_destructors_ex(_php_gmpnum_free, NULL, GMP_RESOURCE_NAME, module_number);
REGISTER_LONG_CONSTANT("GMP_ROUND_ZERO", GMP_ROUND_ZERO, CONST_CS | CONST_PERSISTENT);
REGISTER_LONG_CONSTANT("GMP_ROUND_PLUSINF", GMP_ROUND_PLUSINF, CONST_CS | CONST_PERSISTENT);
diff --git a/ext/iconv/iconv.c b/ext/iconv/iconv.c
index 6b7c483759..2bd527cf79 100644
--- a/ext/iconv/iconv.c
+++ b/ext/iconv/iconv.c
@@ -80,6 +80,9 @@ zend_function_entry iconv_functions[] = {
};
/* }}} */
+ZEND_DECLARE_MODULE_GLOBALS(iconv)
+static PHP_GINIT_FUNCTION(iconv);
+
/* {{{ iconv_module_entry
*/
zend_module_entry iconv_module_entry = {
@@ -92,16 +95,27 @@ zend_module_entry iconv_module_entry = {
NULL,
PHP_MINFO(miconv),
NO_VERSION_YET,
- STANDARD_MODULE_PROPERTIES
+ PHP_MODULE_GLOBALS(iconv),
+ PHP_GINIT(iconv),
+ NULL,
+ NULL,
+ STANDARD_MODULE_PROPERTIES_EX
};
/* }}} */
-ZEND_DECLARE_MODULE_GLOBALS(iconv)
-
#ifdef COMPILE_DL_ICONV
ZEND_GET_MODULE(iconv)
#endif
+/* {{{ PHP_GINIT_FUNCTION */
+static PHP_GINIT_FUNCTION(iconv)
+{
+ iconv_globals->input_encoding = NULL;
+ iconv_globals->output_encoding = NULL;
+ iconv_globals->internal_encoding = NULL;
+}
+/* }}} */
+
#ifdef HAVE_LIBICONV
#define iconv libiconv
#endif
@@ -151,21 +165,11 @@ PHP_INI_BEGIN()
PHP_INI_END()
/* }}} */
-/* {{{ php_iconv_init_globals */
-static void php_iconv_init_globals(zend_iconv_globals *iconv_globals)
-{
- iconv_globals->input_encoding = NULL;
- iconv_globals->output_encoding = NULL;
- iconv_globals->internal_encoding = NULL;
-}
-/* }}} */
-
/* {{{ PHP_MINIT_FUNCTION */
PHP_MINIT_FUNCTION(miconv)
{
char *version = "unknown";
- ZEND_INIT_MODULE_GLOBALS(iconv, php_iconv_init_globals, NULL);
REGISTER_INI_ENTRIES();
#if HAVE_LIBICONV
diff --git a/ext/imap/php_imap.c b/ext/imap/php_imap.c
index 67be96b8e3..d4dc2cb000 100644
--- a/ext/imap/php_imap.c
+++ b/ext/imap/php_imap.c
@@ -80,6 +80,8 @@ unsigned long find_rightmost_bit(unsigned long *valptr);
void fs_give(void **block);
void *fs_get(size_t size);
+ZEND_DECLARE_MODULE_GLOBALS(imap)
+static PHP_GINIT_FUNCTION(imap);
/* {{{ imap_functions[]
*/
@@ -175,12 +177,14 @@ zend_module_entry imap_module_entry = {
PHP_RSHUTDOWN(imap),
PHP_MINFO(imap),
NO_VERSION_YET,
- STANDARD_MODULE_PROPERTIES
+ PHP_MODULE_GLOBALS(imap),
+ PHP_GINIT(imap),
+ NULL,
+ NULL,
+ STANDARD_MODULE_PROPERTIES_EX
};
/* }}} */
-ZEND_DECLARE_MODULE_GLOBALS(imap)
-
#ifdef COMPILE_DL_IMAP
ZEND_GET_MODULE(imap)
#endif
@@ -397,9 +401,9 @@ void mail_getacl(MAILSTREAM *stream, char *mailbox, ACLLIST *alist)
#endif
-/* {{{ php_imap_init_globals
+/* {{{ PHP_GINIT_FUNCTION
*/
-static void php_imap_init_globals(zend_imap_globals *imap_globals)
+static PHP_GINIT_FUNCTION(imap)
{
imap_globals->imap_user = NIL;
imap_globals->imap_password = NIL;
@@ -433,8 +437,6 @@ PHP_MINIT_FUNCTION(imap)
{
unsigned long sa_all = SA_MESSAGES | SA_RECENT | SA_UNSEEN | SA_UIDNEXT | SA_UIDVALIDITY;
- ZEND_INIT_MODULE_GLOBALS(imap, php_imap_init_globals, NULL)
-
#ifndef PHP_WIN32
mail_link(&unixdriver); /* link in the unix driver */
mail_link(&mhdriver); /* link in the mh driver */
diff --git a/ext/interbase/interbase.c b/ext/interbase/interbase.c
index bc0b856694..45ca87f633 100644
--- a/ext/interbase/interbase.c
+++ b/ext/interbase/interbase.c
@@ -43,6 +43,9 @@
#define COMMIT 1
#define RETAIN 2
+ZEND_DECLARE_MODULE_GLOBALS(ibase)
+static PHP_GINIT_FUNCTION(ibase);
+
/* {{{ extension definition structures */
zend_function_entry ibase_functions[] = {
PHP_FE(ibase_connect, NULL)
@@ -178,7 +181,11 @@ zend_module_entry ibase_module_entry = {
PHP_RSHUTDOWN(ibase),
PHP_MINFO(ibase),
NO_VERSION_YET,
- STANDARD_MODULE_PROPERTIES
+ PHP_MODULE_GLOBALS(ibase),
+ PHP_GINIT(ibase),
+ NULL,
+ NULL,
+ STANDARD_MODULE_PROPERTIES_EX
};
#ifdef COMPILE_DL_INTERBASE
@@ -188,8 +195,6 @@ ZEND_GET_MODULE(ibase)
/* True globals, no need for thread safety */
int le_link, le_plink, le_trans;
-ZEND_DECLARE_MODULE_GLOBALS(ibase)
-
/* }}} */
/* error handling ---------------------------- */
@@ -448,7 +453,7 @@ PHP_INI_BEGIN()
PHP_INI_ENTRY("ibase.timeformat", IB_DEF_TIME_FMT, PHP_INI_ALL, NULL)
PHP_INI_END()
-static void php_ibase_init_globals(zend_ibase_globals *ibase_globals)
+static PHP_GINIT_FUNCTION(ibase)
{
ibase_globals->num_persistent = ibase_globals->num_links = 0;
ibase_globals->sql_code = *ibase_globals->errmsg = 0;
@@ -457,8 +462,6 @@ static void php_ibase_init_globals(zend_ibase_globals *ibase_globals)
PHP_MINIT_FUNCTION(ibase)
{
- ZEND_INIT_MODULE_GLOBALS(ibase, php_ibase_init_globals, NULL);
-
REGISTER_INI_ENTRIES();
le_link = zend_register_list_destructors_ex(_php_ibase_close_link, NULL, LE_LINK, module_number);
diff --git a/ext/ldap/ldap.c b/ext/ldap/ldap.c
index 53a970e5d8..ac1e782b10 100644
--- a/ext/ldap/ldap.c
+++ b/ext/ldap/ldap.c
@@ -78,6 +78,7 @@ typedef struct {
} ldap_resultentry;
ZEND_DECLARE_MODULE_GLOBALS(ldap)
+static PHP_GINIT_FUNCTION(ldap);
static
ZEND_BEGIN_ARG_INFO(arg3to6of6_force_ref, 0)
@@ -177,7 +178,11 @@ zend_module_entry ldap_module_entry = {
NULL,
PHP_MINFO(ldap),
NO_VERSION_YET,
- STANDARD_MODULE_PROPERTIES
+ PHP_MODULE_GLOBALS(ldap),
+ PHP_GINIT(ldap),
+ NULL,
+ NULL,
+ STANDARD_MODULE_PROPERTIES_EX
};
#ifdef COMPILE_DL_LDAP
@@ -222,9 +227,9 @@ PHP_INI_BEGIN()
PHP_INI_END()
/* }}} */
-/* {{{ php_ldap_init_globals
+/* {{{ PHP_GINIT_FUNCTION
*/
-static void php_ldap_init_globals(zend_ldap_globals *ldap_globals)
+static PHP_GINIT_FUNCTION(ldap)
{
ldap_globals->num_links = 0;
}
@@ -234,8 +239,6 @@ static void php_ldap_init_globals(zend_ldap_globals *ldap_globals)
*/
PHP_MINIT_FUNCTION(ldap)
{
- ZEND_INIT_MODULE_GLOBALS(ldap, php_ldap_init_globals, NULL);
-
REGISTER_INI_ENTRIES();
/* Constants to be used with deref-parameter in php_ldap_do_search() */
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
diff --git a/ext/mbstring/mbstring.c b/ext/mbstring/mbstring.c
index 32d1bffaae..c1a953cb11 100644
--- a/ext/mbstring/mbstring.c
+++ b/ext/mbstring/mbstring.c
@@ -81,8 +81,9 @@
/* }}} */
/* {{{ prototypes */
-static void _php_mb_globals_ctor(zend_mbstring_globals *pglobals TSRMLS_DC);
-static void _php_mb_globals_dtor(zend_mbstring_globals *pglobals TSRMLS_DC);
+ZEND_DECLARE_MODULE_GLOBALS(mbstring)
+static PHP_GINIT_FUNCTION(mbstring);
+static PHP_GSHUTDOWN_FUNCTION(mbstring);
/* }}} */
/* {{{ php_mb_default_identify_list */
@@ -252,7 +253,11 @@ zend_module_entry mbstring_module_entry = {
PHP_RSHUTDOWN(mbstring),
PHP_MINFO(mbstring),
NO_VERSION_YET,
- STANDARD_MODULE_PROPERTIES
+ PHP_MODULE_GLOBALS(mbstring),
+ PHP_GINIT(mbstring),
+ PHP_GSHUTDOWN(mbstring),
+ NULL,
+ STANDARD_MODULE_PROPERTIES_EX
};
/* }}} */
@@ -264,8 +269,6 @@ static sapi_post_entry php_post_entries[] = {
};
/* }}} */
-ZEND_DECLARE_MODULE_GLOBALS(mbstring)
-
#ifdef COMPILE_DL_MBSTRING
ZEND_GET_MODULE(mbstring)
# ifdef PHP_WIN32
@@ -774,7 +777,7 @@ PHP_INI_END()
/* }}} */
/* {{{ module global initialize handler */
-static void _php_mb_globals_ctor(zend_mbstring_globals *pglobals TSRMLS_DC)
+static PHP_GINIT_FUNCTION(mbstring)
{
MBSTRG(language) = mbfl_no_language_uni;
MBSTRG(current_language) = MBSTRG(language);
@@ -807,18 +810,18 @@ static void _php_mb_globals_ctor(zend_mbstring_globals *pglobals TSRMLS_DC)
MBSTRG(func_overload) = 0;
MBSTRG(encoding_translation) = 0;
MBSTRG(strict_detection) = 0;
- pglobals->outconv = NULL;
+ mbstring_globals->outconv = NULL;
#if HAVE_MBREGEX
- _php_mb_regex_globals_ctor(pglobals TSRMLS_CC);
+ _php_mb_regex_globals_ctor(mbstring_globals TSRMLS_CC);
#endif
}
/* }}} */
-/* {{{ static void _php_mb_globals_dtor() */
-static void _php_mb_globals_dtor(zend_mbstring_globals *pglobals TSRMLS_DC)
+/* {{{ PHP_GSHUTDOWN_FUNCTION */
+static PHP_GSHUTDOWN_FUNCTION(mbstring)
{
#if HAVE_MBREGEX
- _php_mb_regex_globals_dtor(pglobals TSRMLS_CC);
+ _php_mb_regex_globals_dtor(mbstring_globals TSRMLS_CC);
#endif
}
/* }}} */
@@ -828,14 +831,6 @@ PHP_MINIT_FUNCTION(mbstring)
{
__mbfl_allocators = &_php_mb_allocators;
-#ifdef ZTS
- ts_allocate_id(&mbstring_globals_id, sizeof(zend_mbstring_globals),
- (ts_allocate_ctor) _php_mb_globals_ctor,
- (ts_allocate_dtor) _php_mb_globals_dtor);
-#else
- _php_mb_globals_ctor(&mbstring_globals TSRMLS_CC);
-#endif
-
REGISTER_INI_ENTRIES();
if (MBSTRG(encoding_translation)) {
@@ -879,12 +874,6 @@ PHP_MSHUTDOWN_FUNCTION(mbstring)
PHP_MSHUTDOWN(mb_regex) (INIT_FUNC_ARGS_PASSTHRU);
#endif
-#ifdef ZTS
- ts_free_id(mbstring_globals_id);
-#else
- _php_mb_globals_dtor(&mbstring_globals TSRMLS_CC);
-#endif
-
return SUCCESS;
}
/* }}} */
diff --git a/ext/mcrypt/mcrypt.c b/ext/mcrypt/mcrypt.c
index da4ce8ef79..4f04977652 100644
--- a/ext/mcrypt/mcrypt.c
+++ b/ext/mcrypt/mcrypt.c
@@ -93,6 +93,8 @@ static PHP_MINFO_FUNCTION(mcrypt);
static PHP_MINIT_FUNCTION(mcrypt);
static PHP_MSHUTDOWN_FUNCTION(mcrypt);
+ZEND_DECLARE_MODULE_GLOBALS(mcrypt)
+
zend_module_entry mcrypt_module_entry = {
STANDARD_MODULE_HEADER,
"mcrypt",
@@ -101,11 +103,13 @@ zend_module_entry mcrypt_module_entry = {
NULL, NULL,
PHP_MINFO(mcrypt),
NO_VERSION_YET,
- STANDARD_MODULE_PROPERTIES,
+ PHP_MODULE_GLOBALS(mcrypt),
+ NULL,
+ NULL,
+ NULL,
+ STANDARD_MODULE_PROPERTIES_EX
};
-ZEND_DECLARE_MODULE_GLOBALS(mcrypt)
-
#ifdef COMPILE_DL_MCRYPT
ZEND_GET_MODULE(mcrypt)
#endif
@@ -245,11 +249,6 @@ static void php_mcrypt_module_dtor(zend_rsrc_list_entry *rsrc TSRMLS_DC)
static PHP_MINIT_FUNCTION(mcrypt)
{
-#if defined(ZTS)
- ZEND_INIT_MODULE_GLOBALS(mcrypt, NULL, NULL);
- Z_TYPE(mcrypt_module_entry) = type;
-#endif
-
le_mcrypt = zend_register_list_destructors_ex(php_mcrypt_module_dtor, NULL, "mcrypt", module_number);
/* modes for mcrypt_??? routines */
diff --git a/ext/mime_magic/mime_magic.c b/ext/mime_magic/mime_magic.c
index 51bd495aa2..b34418ef5d 100644
--- a/ext/mime_magic/mime_magic.c
+++ b/ext/mime_magic/mime_magic.c
@@ -212,7 +212,7 @@ static magic_req_rec *magic_set_config(void);
static void magic_free_config(magic_req_rec *);
ZEND_DECLARE_MODULE_GLOBALS(mime_magic)
-
+static PHP_GINIT_FUNCTION(mime_magic);
/* True global resources - no need for thread safety here */
static magic_server_config_rec mime_global;
@@ -240,7 +240,15 @@ zend_module_entry mime_magic_module_entry = {
#if ZEND_MODULE_API_NO >= 20010901
"0.1",
#endif
+#if ZEND_MODULE_API_NO >= 20060613
+ PHP_MODULE_GLOBALS(mime_magic),
+ PHP_GINIT(mime_magic),
+ NULL,
+ NULL,
+ STANDARD_MODULE_PROPERTIES_EX
+#else
STANDARD_MODULE_PROPERTIES
+#endif
};
/* }}} */
@@ -256,9 +264,9 @@ STD_PHP_INI_BOOLEAN("mime_magic.debug", "0", PHP_INI_SYSTEM, OnUpdateBool, debug
PHP_INI_END()
/* }}} */
-/* {{{ php_mime_magic_init_globals
+/* {{{ PHP_GINIT_FUNCTION
*/
-static void php_mime_magic_init_globals(zend_mime_magic_globals *mime_magic_globals)
+static PHP_GINIT_FUNCTION(mime_magic)
{
memset(mime_magic_globals, 0, sizeof(zend_mime_magic_globals));
mime_global.magic = NULL;
@@ -270,7 +278,6 @@ static void php_mime_magic_init_globals(zend_mime_magic_globals *mime_magic_glob
*/
PHP_MINIT_FUNCTION(mime_magic)
{
- ZEND_INIT_MODULE_GLOBALS(mime_magic, php_mime_magic_init_globals, NULL);
REGISTER_INI_ENTRIES();
if(MIME_MAGIC_G(magicfile)) {
diff --git a/ext/mssql/php_mssql.c b/ext/mssql/php_mssql.c
index cce69ad92f..6b186d7822 100644
--- a/ext/mssql/php_mssql.c
+++ b/ext/mssql/php_mssql.c
@@ -81,6 +81,9 @@ zend_function_entry mssql_functions[] = {
{NULL, NULL, NULL}
};
+ZEND_DECLARE_MODULE_GLOBALS(mssql)
+static PHP_GINIT_FUNCTION(mssql);
+
zend_module_entry mssql_module_entry =
{
STANDARD_MODULE_HEADER,
@@ -91,12 +94,14 @@ zend_module_entry mssql_module_entry =
PHP_RINIT(mssql),
PHP_RSHUTDOWN(mssql),
PHP_MINFO(mssql),
- NO_VERSION_YET,
- STANDARD_MODULE_PROPERTIES
+ NO_VERSION_YET,
+ PHP_MODULE_GLOBALS(mssql),
+ PHP_GINIT(mssql),
+ NULL,
+ NULL,
+ STANDARD_MODULE_PROPERTIES_EX
};
-ZEND_DECLARE_MODULE_GLOBALS(mssql)
-
#ifdef COMPILE_DL_MSSQL
ZEND_GET_MODULE(mssql)
# ifdef PHP_WIN32
@@ -273,7 +278,7 @@ static void _mssql_bind_hash_dtor(void *data)
zval_ptr_dtor(&(bind->zval));
}
-static void php_mssql_init_globals(zend_mssql_globals *mssql_globals)
+static PHP_GINIT_FUNCTION(mssql)
{
long compatability_mode;
@@ -288,8 +293,6 @@ static void php_mssql_init_globals(zend_mssql_globals *mssql_globals)
PHP_MINIT_FUNCTION(mssql)
{
- ZEND_INIT_MODULE_GLOBALS(mssql, php_mssql_init_globals, NULL);
-
REGISTER_INI_ENTRIES();
le_statement = zend_register_list_destructors_ex(_free_mssql_statement, NULL, "mssql statement", module_number);
diff --git a/ext/mysql/php_mysql.c b/ext/mysql/php_mysql.c
index 023a87e9fb..ea90ee49e0 100644
--- a/ext/mysql/php_mysql.c
+++ b/ext/mysql/php_mysql.c
@@ -116,6 +116,9 @@ static int le_result, le_link, le_plink;
(mysql_field_count(mysql)>0)
#endif
+ZEND_DECLARE_MODULE_GLOBALS(mysql)
+static PHP_GINIT_FUNCTION(mysql);
+
typedef struct _php_mysql_conn {
MYSQL conn;
int active_result_id;
@@ -219,12 +222,14 @@ zend_module_entry mysql_module_entry = {
PHP_RSHUTDOWN(mysql),
PHP_MINFO(mysql),
"1.0",
- STANDARD_MODULE_PROPERTIES
+ PHP_MODULE_GLOBALS(mysql),
+ PHP_GINIT(mysql),
+ NULL,
+ NULL,
+ STANDARD_MODULE_PROPERTIES_EX
};
/* }}} */
-ZEND_DECLARE_MODULE_GLOBALS(mysql)
-
#ifdef COMPILE_DL_MYSQL
ZEND_GET_MODULE(mysql)
#endif
@@ -353,9 +358,9 @@ PHP_INI_BEGIN()
PHP_INI_END()
/* }}} */
-/* {{{ php_mysql_init_globals
+/* {{{ PHP_GINIT_FUNCTION
*/
-static void php_mysql_init_globals(zend_mysql_globals *mysql_globals)
+static PHP_GINIT_FUNCTION(mysql)
{
mysql_globals->num_persistent = 0;
mysql_globals->default_socket = NULL;
@@ -374,8 +379,6 @@ static void php_mysql_init_globals(zend_mysql_globals *mysql_globals)
*/
ZEND_MODULE_STARTUP_D(mysql)
{
- ZEND_INIT_MODULE_GLOBALS(mysql, php_mysql_init_globals, NULL);
-
REGISTER_INI_ENTRIES();
le_result = zend_register_list_destructors_ex(_free_mysql_result, NULL, "mysql result", module_number);
le_link = zend_register_list_destructors_ex(_close_mysql_link, NULL, "mysql link", module_number);
diff --git a/ext/mysqli/mysqli.c b/ext/mysqli/mysqli.c
index cad94021e8..cd7121046d 100644
--- a/ext/mysqli/mysqli.c
+++ b/ext/mysqli/mysqli.c
@@ -35,6 +35,8 @@
#define MYSQLI_USE_RESULT 1
ZEND_DECLARE_MODULE_GLOBALS(mysqli)
+static PHP_GINIT_FUNCTION(mysqli);
+
static zend_object_handlers mysqli_object_handlers;
static HashTable classes;
static HashTable mysqli_driver_properties;
@@ -367,7 +369,11 @@ zend_module_entry mysqli_module_entry = {
PHP_RSHUTDOWN(mysqli),
PHP_MINFO(mysqli),
"0.1", /* Replace with version number for your extension */
- STANDARD_MODULE_PROPERTIES
+ PHP_MODULE_GLOBALS(mysqli),
+ PHP_GINIT(mysqli),
+ NULL,
+ NULL,
+ STANDARD_MODULE_PROPERTIES_EX
};
/* }}} */
@@ -389,9 +395,9 @@ PHP_INI_END()
/* }}} */
-/* {{{ php_mysqli_init_globals
+/* {{{ PHP_GINIT_FUNCTION
*/
-static void php_mysqli_init_globals(zend_mysqli_globals *mysqli_globals)
+static PHP_GINIT_FUNCTION(mysqli)
{
mysqli_globals->num_links = 0;
mysqli_globals->max_links = 0;
@@ -418,7 +424,6 @@ PHP_MINIT_FUNCTION(mysqli)
zend_class_entry *ce,cex;
zend_object_handlers *std_hnd = zend_get_std_object_handlers();
- ZEND_INIT_MODULE_GLOBALS(mysqli, php_mysqli_init_globals, NULL);
REGISTER_INI_ENTRIES();
memcpy(&mysqli_object_handlers, zend_get_std_object_handlers(), sizeof(zend_object_handlers));
diff --git a/ext/oci8/oci8.c b/ext/oci8/oci8.c
index 30d287d460..c5aad2ab1a 100644
--- a/ext/oci8/oci8.c
+++ b/ext/oci8/oci8.c
@@ -50,6 +50,7 @@
#include "php_oci8_int.h"
ZEND_DECLARE_MODULE_GLOBALS(oci)
+static PHP_GINIT_FUNCTION(oci);
/* True globals, no need for thread safety */
int le_connection;
@@ -371,7 +372,11 @@ zend_module_entry oci8_module_entry = {
PHP_RSHUTDOWN(oci), /* per-request shutdown function */
PHP_MINFO(oci), /* information function */
"1.1",
- STANDARD_MODULE_PROPERTIES
+ PHP_MODULE_GLOBALS(oci), /* globals descriptor */
+ PHP_GINIT(oci), /* globals ctor */
+ NULL, /* globals dtor */
+ NULL, /* post deactivate */
+ STANDARD_MODULE_PROPERTIES_EX
};
/* }}} */
@@ -454,10 +459,10 @@ static void php_oci_cleanup_global_handles(TSRMLS_D)
}
} /* }}} */
-/* {{{ php_oci_init_globals()
+/* {{{ PHP_GINIT_FUNCTION
Zerofill globals during module init
*/
-static void php_oci_init_globals(zend_oci_globals *oci_globals TSRMLS_DC)
+static PHP_GINIT_FUNCTION(oci)
{
memset(oci_globals, 0, sizeof(zend_oci_globals));
}
@@ -486,7 +491,6 @@ PHP_MINIT_FUNCTION(oci)
OCIInitialize(PHP_OCI_INIT_MODE, NULL, NULL, NULL, NULL);
#endif
- ZEND_INIT_MODULE_GLOBALS(oci, php_oci_init_globals, NULL);
REGISTER_INI_ENTRIES();
le_statement = zend_register_list_destructors_ex(php_oci_statement_list_dtor, NULL, "oci8 statement", module_number);
diff --git a/ext/odbc/php_odbc.c b/ext/odbc/php_odbc.c
index 518d3bae76..0b7cee68e4 100644
--- a/ext/odbc/php_odbc.c
+++ b/ext/odbc/php_odbc.c
@@ -130,6 +130,9 @@ zend_function_entry odbc_functions[] = {
};
/* }}} */
+ZEND_DECLARE_MODULE_GLOBALS(odbc);
+static PHP_GINIT_FUNCTION(odbc);
+
/* {{{ odbc_module_entry
*/
zend_module_entry odbc_module_entry = {
@@ -142,16 +145,14 @@ zend_module_entry odbc_module_entry = {
PHP_RSHUTDOWN(odbc),
PHP_MINFO(odbc),
"1.0",
- STANDARD_MODULE_PROPERTIES
+ PHP_MODULE_GLOBALS(odbc),
+ PHP_GINIT(odbc),
+ NULL,
+ NULL,
+ STANDARD_MODULE_PROPERTIES_EX
};
/* }}} */
-#ifdef ZTS
-int odbc_globals_id;
-#else
-ZEND_API php_odbc_globals odbc_globals;
-#endif
-
#ifdef COMPILE_DL_ODBC
ZEND_GET_MODULE(odbc)
# ifdef PHP_WIN32
@@ -383,32 +384,30 @@ static PHP_INI_DISP(display_lrl)
*/
PHP_INI_BEGIN()
STD_PHP_INI_BOOLEAN("odbc.allow_persistent", "1", PHP_INI_SYSTEM, OnUpdateLong,
- allow_persistent, php_odbc_globals, odbc_globals)
+ allow_persistent, zend_odbc_globals, odbc_globals)
STD_PHP_INI_ENTRY_EX("odbc.max_persistent", "-1", PHP_INI_SYSTEM, OnUpdateLong,
- max_persistent, php_odbc_globals, odbc_globals, display_link_nums)
+ max_persistent, zend_odbc_globals, odbc_globals, display_link_nums)
STD_PHP_INI_ENTRY_EX("odbc.max_links", "-1", PHP_INI_SYSTEM, OnUpdateLong,
- max_links, php_odbc_globals, odbc_globals, display_link_nums)
+ max_links, zend_odbc_globals, odbc_globals, display_link_nums)
STD_PHP_INI_ENTRY("odbc.default_db", NULL, PHP_INI_ALL, OnUpdateString,
- defDB, php_odbc_globals, odbc_globals)
+ defDB, zend_odbc_globals, odbc_globals)
STD_PHP_INI_ENTRY("odbc.default_user", NULL, PHP_INI_ALL, OnUpdateString,
- defUser, php_odbc_globals, odbc_globals)
+ defUser, zend_odbc_globals, odbc_globals)
STD_PHP_INI_ENTRY_EX("odbc.default_pw", NULL, PHP_INI_ALL, OnUpdateString,
- defPW, php_odbc_globals, odbc_globals, display_defPW)
+ defPW, zend_odbc_globals, odbc_globals, display_defPW)
STD_PHP_INI_ENTRY_EX("odbc.defaultlrl", "4096", PHP_INI_ALL, OnUpdateLong,
- defaultlrl, php_odbc_globals, odbc_globals, display_lrl)
+ defaultlrl, zend_odbc_globals, odbc_globals, display_lrl)
STD_PHP_INI_ENTRY_EX("odbc.defaultbinmode", "1", PHP_INI_ALL, OnUpdateLong,
- defaultbinmode, php_odbc_globals, odbc_globals, display_binmode)
+ defaultbinmode, zend_odbc_globals, odbc_globals, display_binmode)
STD_PHP_INI_BOOLEAN("odbc.check_persistent", "1", PHP_INI_SYSTEM, OnUpdateLong,
- check_persistent, php_odbc_globals, odbc_globals)
+ check_persistent, zend_odbc_globals, odbc_globals)
PHP_INI_END()
/* }}} */
-#ifdef ZTS
-static void php_odbc_init_globals(php_odbc_globals *odbc_globals_p TSRMLS_DC)
+static PHP_GINIT_FUNCTION(odbc)
{
- ODBCG(num_persistent) = 0;
+ odbc_globals->num_persistent = 0;
}
-#endif
/* {{{ PHP_MINIT_FUNCTION */
PHP_MINIT_FUNCTION(odbc)
@@ -418,12 +417,6 @@ PHP_MINIT_FUNCTION(odbc)
RETCODE rc;
#endif
-#ifdef ZTS
- ts_allocate_id(&odbc_globals_id, sizeof(php_odbc_globals), php_odbc_init_globals, NULL);
-#else
- ODBCG(num_persistent) = 0;
-#endif
-
REGISTER_INI_ENTRIES();
le_result = zend_register_list_destructors_ex(_free_odbc_result, NULL, "odbc result", module_number);
le_conn = zend_register_list_destructors_ex(_close_odbc_conn, NULL, "odbc link", module_number);
diff --git a/ext/odbc/php_odbc_includes.h b/ext/odbc/php_odbc_includes.h
index d3ee4d5ea3..bdb67ec5d2 100644
--- a/ext/odbc/php_odbc_includes.h
+++ b/ext/odbc/php_odbc_includes.h
@@ -249,7 +249,7 @@ typedef struct odbc_result {
odbc_connection *conn_ptr;
} odbc_result;
-typedef struct {
+ZEND_BEGIN_MODULE_GLOBALS(odbc)
char *defDB;
char *defUser;
char *defPW;
@@ -266,7 +266,7 @@ typedef struct {
char lasterrormsg[SQL_MAX_MESSAGE_LENGTH];
HashTable *resource_list;
HashTable *resource_plist;
-} php_odbc_globals;
+ZEND_END_MODULE_GLOBALS(odbc)
int odbc_add_result(HashTable *list, odbc_result *result);
odbc_result *odbc_get_result(HashTable *list, int count);
@@ -284,7 +284,7 @@ void odbc_sql_error(ODBC_SQL_ERROR_PARAMS);
#define IS_SQL_BINARY(x) (x == SQL_BINARY || x == SQL_VARBINARY || x == SQL_LONGVARBINARY)
#ifdef ZTS
-# define ODBCG(v) TSRMG(odbc_globals_id, php_odbc_globals *, v)
+# define ODBCG(v) TSRMG(odbc_globals_id, zend_odbc_globals *, v)
#else
# define ODBCG(v) (odbc_globals.v)
extern ZEND_API php_odbc_globals odbc_globals;
diff --git a/ext/pcntl/pcntl.c b/ext/pcntl/pcntl.c
index 8f18088948..c0e13c8380 100755
--- a/ext/pcntl/pcntl.c
+++ b/ext/pcntl/pcntl.c
@@ -42,6 +42,7 @@
#endif
ZEND_DECLARE_MODULE_GLOBALS(pcntl)
+static PHP_GINIT_FUNCTION(pcntl);
zend_function_entry pcntl_functions[] = {
PHP_FE(pcntl_fork, NULL)
@@ -75,7 +76,11 @@ zend_module_entry pcntl_module_entry = {
PHP_RSHUTDOWN(pcntl),
PHP_MINFO(pcntl),
NO_VERSION_YET,
- STANDARD_MODULE_PROPERTIES
+ PHP_MODULE_GLOBALS(pcntl),
+ PHP_GINIT(pcntl),
+ NULL,
+ NULL,
+ STANDARD_MODULE_PROPERTIES_EX
};
#ifdef COMPILE_DL_PCNTL
@@ -160,7 +165,7 @@ void php_register_signal_constants(INIT_FUNC_ARGS)
#endif
}
-static void php_pcntl_init_globals(zend_pcntl_globals *pcntl_globals)
+static PHP_GINIT_FUNCTION(pcntl)
{
memset(pcntl_globals, 0, sizeof(*pcntl_globals));
}
@@ -175,7 +180,6 @@ PHP_RINIT_FUNCTION(pcntl)
PHP_MINIT_FUNCTION(pcntl)
{
php_register_signal_constants(INIT_FUNC_ARGS_PASSTHRU);
- ZEND_INIT_MODULE_GLOBALS(pcntl, php_pcntl_init_globals, NULL);
php_add_tick_function(pcntl_tick_handler);
return SUCCESS;
diff --git a/ext/pcre/php_pcre.c b/ext/pcre/php_pcre.c
index e4dee71d4c..f07fc8c91d 100644
--- a/ext/pcre/php_pcre.c
+++ b/ext/pcre/php_pcre.c
@@ -97,7 +97,7 @@ static void php_free_pcre_cache(void *data)
}
-static void php_pcre_init_globals(zend_pcre_globals *pcre_globals TSRMLS_DC)
+static PHP_GINIT_FUNCTION(pcre)
{
zend_hash_init(&pcre_globals->pcre_cache, 0, NULL, php_free_pcre_cache, 1);
pcre_globals->backtrack_limit = 0;
@@ -105,7 +105,7 @@ static void php_pcre_init_globals(zend_pcre_globals *pcre_globals TSRMLS_DC)
pcre_globals->error_code = PHP_PCRE_NO_ERROR;
}
-static void php_pcre_shutdown_globals(zend_pcre_globals *pcre_globals TSRMLS_DC)
+static PHP_GSHUTDOWN_FUNCTION(pcre)
{
zend_hash_destroy(&pcre_globals->pcre_cache);
}
@@ -129,8 +129,6 @@ static PHP_MINFO_FUNCTION(pcre)
/* {{{ PHP_MINIT_FUNCTION(pcre) */
static PHP_MINIT_FUNCTION(pcre)
{
- ZEND_INIT_MODULE_GLOBALS(pcre, php_pcre_init_globals, php_pcre_shutdown_globals);
-
REGISTER_INI_ENTRIES();
REGISTER_LONG_CONSTANT("PREG_PATTERN_ORDER", PREG_PATTERN_ORDER, CONST_CS | CONST_PERSISTENT);
@@ -154,12 +152,6 @@ static PHP_MINIT_FUNCTION(pcre)
/* {{{ PHP_MSHUTDOWN_FUNCTION(pcre) */
static PHP_MSHUTDOWN_FUNCTION(pcre)
{
-#ifdef ZTS
- ts_free_id(pcre_globals_id);
-#else
- php_pcre_shutdown_globals(&pcre_globals TSRMLS_CC);
-#endif
-
UNREGISTER_INI_ENTRIES();
return SUCCESS;
@@ -1779,7 +1771,11 @@ zend_module_entry pcre_module_entry = {
NULL,
PHP_MINFO(pcre),
NO_VERSION_YET,
- STANDARD_MODULE_PROPERTIES
+ PHP_MODULE_GLOBALS(pcre),
+ PHP_GINIT(pcre),
+ PHP_GSHUTDOWN(pcre),
+ NULL,
+ STANDARD_MODULE_PROPERTIES_EX
};
#ifdef COMPILE_DL_PCRE
diff --git a/ext/pdo/pdo.c b/ext/pdo/pdo.c
index ab4134715c..1e78952d0c 100755
--- a/ext/pdo/pdo.c
+++ b/ext/pdo/pdo.c
@@ -36,6 +36,7 @@
static zend_class_entry *spl_ce_RuntimeException;
ZEND_DECLARE_MODULE_GLOBALS(pdo)
+static PHP_GINIT_FUNCTION(pdo);
/* True global resources - no need for thread safety here */
@@ -146,7 +147,11 @@ zend_module_entry pdo_module_entry = {
NULL,
PHP_MINFO(pdo),
"1.0.4dev",
- STANDARD_MODULE_PROPERTIES
+ PHP_MODULE_GLOBALS(pdo),
+ PHP_GINIT(pdo),
+ NULL,
+ NULL,
+ STANDARD_MODULE_PROPERTIES_EX
};
/* }}} */
@@ -163,8 +168,8 @@ PHP_INI_BEGIN()
PHP_INI_END()
/* }}} */
-/* {{{ php_pdo_init_globals */
-static void php_pdo_init_globals(zend_pdo_globals *pdo_globals)
+/* {{{ PHP_GINIT_FUNCTION */
+static PHP_GINIT_FUNCTION(pdo)
{
pdo_globals->global_value = 0;
}
@@ -321,7 +326,6 @@ PHP_MINIT_FUNCTION(pdo)
spl_ce_RuntimeException = NULL;
- ZEND_INIT_MODULE_GLOBALS(pdo, php_pdo_init_globals, NULL);
REGISTER_INI_ENTRIES();
if (FAILURE == pdo_sqlstate_init_error_table()) {
diff --git a/ext/pdo_dblib/pdo_dblib.c b/ext/pdo_dblib/pdo_dblib.c
index eb2e886ce8..68f3da8c7e 100644
--- a/ext/pdo_dblib/pdo_dblib.c
+++ b/ext/pdo_dblib/pdo_dblib.c
@@ -33,6 +33,7 @@
#include "zend_exceptions.h"
ZEND_DECLARE_MODULE_GLOBALS(dblib)
+static PHP_GINIT_FUNCTION(dblib)
zend_function_entry pdo_dblib_functions[] = {
{NULL, NULL, NULL}
@@ -66,7 +67,11 @@ zend_module_entry pdo_dblib_module_entry = {
PHP_RSHUTDOWN(pdo_dblib),
PHP_MINFO(pdo_dblib),
"1.0.1",
- STANDARD_MODULE_PROPERTIES
+ PHP_MODULE_GLOBASLS(dblib),
+ PHP_GINIT(dblib),
+ NULL,
+ NULL,
+ STANDARD_MODULE_PROPERTIES_EX
};
#if defined(COMPILE_DL_PDO_DBLIB) || defined(COMPILE_DL_PDO_MSSQL)
@@ -146,11 +151,10 @@ int msg_handler(DBPROCESS *dbproc, DBINT msgno, int msgstate,
return 0;
}
-static int init_dblib_globals(zend_dblib_globals *g)
+static PHP_GINIT_FUNCTION(dblib)
{
- memset(g, 0, sizeof(*g));
- g->err.sqlstate = g->sqlstate;
- return SUCCESS;
+ memset(dblib_globals, 0, sizeof(*dblib_globals));
+ dblib_globals->err.sqlstate = dblib_globals->sqlstate;
}
PHP_RSHUTDOWN_FUNCTION(pdo_dblib)
@@ -180,8 +184,6 @@ PHP_MINIT_FUNCTION(pdo_dblib)
return FAILURE;
}
- ZEND_INIT_MODULE_GLOBALS(dblib, init_dblib_globals, NULL);
-
/* TODO:
dbsetifile()
diff --git a/ext/pgsql/pgsql.c b/ext/pgsql/pgsql.c
index 3c3a71eb7a..313340bac5 100644
--- a/ext/pgsql/pgsql.c
+++ b/ext/pgsql/pgsql.c
@@ -81,6 +81,9 @@
#define CHECK_DEFAULT_LINK(x) if ((x) == -1) { php_error_docref(NULL TSRMLS_CC, E_WARNING, "No PostgreSQL link opened yet"); }
+ZEND_DECLARE_MODULE_GLOBALS(pgsql)
+static PHP_GINIT_FUNCTION(pgsql);
+
/* {{{ pgsql_functions[]
*/
zend_function_entry pgsql_functions[] = {
@@ -248,7 +251,11 @@ zend_module_entry pgsql_module_entry = {
PHP_RSHUTDOWN(pgsql),
PHP_MINFO(pgsql),
NO_VERSION_YET,
- STANDARD_MODULE_PROPERTIES
+ PHP_MODULE_GLOBALS(pgsql),
+ PHP_GINIT(pgsql),
+ NULL,
+ NULL,
+ STANDARD_MODULE_PROPERTIES_EX
};
/* }}} */
@@ -258,8 +265,6 @@ ZEND_GET_MODULE(pgsql)
static int le_link, le_plink, le_result, le_lofp, le_string;
-ZEND_DECLARE_MODULE_GLOBALS(pgsql)
-
/* {{{ _php_pgsql_trim_message */
static char * _php_pgsql_trim_message(const char *message, int *len)
{
@@ -446,9 +451,9 @@ STD_PHP_INI_BOOLEAN( "pgsql.log_notice", "0", PHP_INI_ALL, OnUpda
PHP_INI_END()
/* }}} */
-/* {{{ php_pgsql_init_globals
+/* {{{ PHP_GINIT_FUNCTION
*/
-static void php_pgsql_init_globals(zend_pgsql_globals *pgsql_globals)
+static PHP_GINIT_FUNCTION(pgsql)
{
memset(pgsql_globals, 0, sizeof(zend_pgsql_globals));
/* Initilize notice message hash at MINIT only */
@@ -460,8 +465,6 @@ static void php_pgsql_init_globals(zend_pgsql_globals *pgsql_globals)
*/
PHP_MINIT_FUNCTION(pgsql)
{
- ZEND_INIT_MODULE_GLOBALS(pgsql, php_pgsql_init_globals, NULL);
-
REGISTER_INI_ENTRIES();
le_link = zend_register_list_destructors_ex(_close_pgsql_link, NULL, "pgsql link", module_number);
diff --git a/ext/posix/posix.c b/ext/posix/posix.c
index edbc561ec1..bb1935c435 100644
--- a/ext/posix/posix.c
+++ b/ext/posix/posix.c
@@ -49,6 +49,7 @@
#endif
ZEND_DECLARE_MODULE_GLOBALS(posix)
+static PHP_MINFO_FUNCTION(posix);
/* {{{ posix_functions[]
*/
@@ -148,7 +149,7 @@ static PHP_MINFO_FUNCTION(posix)
}
/* }}} */
-static void php_posix_init_globals(zend_posix_globals *posix_globals TSRMLS_DC)
+static PHP_GINIT_FUNCTION(posix)
{
posix_globals->last_error = 0;
}
@@ -157,7 +158,6 @@ static void php_posix_init_globals(zend_posix_globals *posix_globals TSRMLS_DC)
*/
static PHP_MINIT_FUNCTION(posix)
{
- ZEND_INIT_MODULE_GLOBALS(posix, php_posix_init_globals, NULL);
REGISTER_LONG_CONSTANT("POSIX_F_OK", F_OK, CONST_CS | CONST_PERSISTENT);
REGISTER_LONG_CONSTANT("POSIX_X_OK", X_OK, CONST_CS | CONST_PERSISTENT);
REGISTER_LONG_CONSTANT("POSIX_W_OK", W_OK, CONST_CS | CONST_PERSISTENT);
@@ -182,8 +182,6 @@ static PHP_MINIT_FUNCTION(posix)
}
/* }}} */
-static PHP_MINFO_FUNCTION(posix);
-
/* {{{ posix_module_entry
*/
zend_module_entry posix_module_entry = {
@@ -195,8 +193,12 @@ zend_module_entry posix_module_entry = {
NULL,
NULL,
PHP_MINFO(posix),
- NO_VERSION_YET,
- STANDARD_MODULE_PROPERTIES
+ NO_VERSION_YET,
+ PHP_MODULE_GLOBALS(posix),
+ PHP_GINIT(posix),
+ NULL,
+ NULL,
+ STANDARD_MODULE_PROPERTIES_EX
};
/* }}} */
diff --git a/ext/recode/recode.c b/ext/recode/recode.c
index 68494bbb39..cb9ad7d492 100644
--- a/ext/recode/recode.c
+++ b/ext/recode/recode.c
@@ -64,6 +64,7 @@ ZEND_END_MODULE_GLOBALS(recode)
#endif
ZEND_DECLARE_MODULE_GLOBALS(recode);
+static PHP_GINIT_FUNCTION(recode);
/* {{{ module stuff */
static zend_function_entry php_recode_functions[] = {
@@ -83,22 +84,24 @@ zend_module_entry recode_module_entry = {
NULL,
PHP_MINFO(recode),
NO_VERSION_YET,
- STANDARD_MODULE_PROPERTIES
+ PHP_MODULE_GLOBALS(recode),
+ PHP_GINIT(recode),
+ NULL,
+ NULL,
+ STANDARD_MODULE_PROPERTIES_EX
};
#ifdef COMPILE_DL_RECODE
ZEND_GET_MODULE(recode)
#endif
-static void php_recode_init_globals (zend_recode_globals *rg)
+static PHP_GINIT_FUNCTION(recode)
{
- rg->outer = NULL;
+ recode_globals->outer = NULL;
}
PHP_MINIT_FUNCTION(recode)
{
- ZEND_INIT_MODULE_GLOBALS(recode, php_recode_init_globals, NULL);
-
ReSG(outer) = recode_new_outer(false);
if (ReSG(outer) == NULL) {
return FAILURE;
diff --git a/ext/session/session.c b/ext/session/session.c
index dc7939ea16..9feb7784d0 100644
--- a/ext/session/session.c
+++ b/ext/session/session.c
@@ -82,6 +82,7 @@ zend_function_entry session_functions[] = {
/* }}} */
PHPAPI ZEND_DECLARE_MODULE_GLOBALS(ps);
+static PHP_GINIT_FUNCTION(ps);
static ps_module *_php_find_ps_module(char *name TSRMLS_DC);
static const ps_serializer *_php_find_ps_serializer(char *name TSRMLS_DC);
@@ -257,7 +258,11 @@ zend_module_entry session_module_entry = {
PHP_RINIT(session), PHP_RSHUTDOWN(session),
PHP_MINFO(session),
NO_VERSION_YET,
- STANDARD_MODULE_PROPERTIES
+ PHP_MODULE_GLOBALS(ps),
+ PHP_GINIT(ps),
+ NULL,
+ NULL,
+ STANDARD_MODULE_PROPERTIES_EX
};
#ifdef COMPILE_DL_SESSION
@@ -1831,7 +1836,7 @@ PHP_RSHUTDOWN_FUNCTION(session)
}
/* }}} */
-static void php_minit_session_globals(php_ps_globals *ps_globals)
+static PHP_GINIT_FUNCTION(ps)
{
ps_globals->save_path = NULL;
ps_globals->session_name = NULL;
@@ -1844,15 +1849,6 @@ static void php_minit_session_globals(php_ps_globals *ps_globals)
PHP_MINIT_FUNCTION(session)
{
-#ifdef ZTS
- php_ps_globals *ps_globals;
-
- ts_allocate_id(&ps_globals_id, sizeof(php_ps_globals), (ts_allocate_ctor) php_minit_session_globals, NULL);
- ps_globals = ts_resource(ps_globals_id);
-#else
- php_minit_session_globals(&ps_globals);
-#endif
-
zend_register_auto_global("_SESSION", sizeof("_SESSION")-1, NULL TSRMLS_CC);
PS(module_number) = module_number; /* if we really need this var we need to init it in zts mode as well! */
diff --git a/ext/skeleton/skeleton.c b/ext/skeleton/skeleton.c
index a5cf506f65..ae07e5373f 100644
--- a/ext/skeleton/skeleton.c
+++ b/ext/skeleton/skeleton.c
@@ -77,7 +77,6 @@ static void php_extname_init_globals(zend_extname_globals *extname_globals)
PHP_MINIT_FUNCTION(extname)
{
/* If you have INI entries, uncomment these lines
- ZEND_INIT_MODULE_GLOBALS(extname, php_extname_init_globals, NULL);
REGISTER_INI_ENTRIES();
*/
return SUCCESS;
diff --git a/ext/snmp/snmp.c b/ext/snmp/snmp.c
index ab6a366775..4964890722 100644
--- a/ext/snmp/snmp.c
+++ b/ext/snmp/snmp.c
@@ -107,6 +107,7 @@
#define SNMP_VALUE_OBJECT 2
ZEND_DECLARE_MODULE_GLOBALS(snmp)
+static PHP_GINIT_FUNCTION(snmp);
/* constant - can be shared among threads */
static oid objid_mib[] = {1, 3, 6, 1, 2, 1};
@@ -164,7 +165,11 @@ zend_module_entry snmp_module_entry = {
NULL,
PHP_MINFO(snmp),
NO_VERSION_YET,
- STANDARD_MODULE_PROPERTIES
+ PHP_MODULE_GLOBALS(snmp),
+ PHP_GINIT(snmp),
+ NULL,
+ NULL,
+ STANDARD_MODULE_PROPERTIES_EX
};
/* }}} */
@@ -174,9 +179,9 @@ ZEND_GET_MODULE(snmp)
/* THREAD_LS snmp_module php_snmp_module; - may need one of these at some point */
-/* {{{ php_snmp_init_globals
+/* {{{ PHP_GINIT_FUNCTION
*/
-static void php_snmp_init_globals(zend_snmp_globals *snmp_globals)
+static PHP_GINIT_FUNCTION(snmp)
{
snmp_globals->valueretrieval = 0;
}
@@ -193,8 +198,6 @@ PHP_MINIT_FUNCTION(snmp)
netsnmp_ds_set_boolean(NETSNMP_DS_LIBRARY_ID, NETSNMP_DS_LIB_DONT_PERSIST_STATE, 1);
#endif
- ZEND_INIT_MODULE_GLOBALS(snmp, php_snmp_init_globals, NULL);
-
REGISTER_LONG_CONSTANT("SNMP_VALUE_LIBRARY", SNMP_VALUE_LIBRARY, CONST_CS | CONST_PERSISTENT);
REGISTER_LONG_CONSTANT("SNMP_VALUE_PLAIN", SNMP_VALUE_PLAIN, CONST_CS | CONST_PERSISTENT);
REGISTER_LONG_CONSTANT("SNMP_VALUE_OBJECT", SNMP_VALUE_OBJECT, CONST_CS | CONST_PERSISTENT);
diff --git a/ext/sockets/sockets.c b/ext/sockets/sockets.c
index d706674baf..893f5cefe5 100644
--- a/ext/sockets/sockets.c
+++ b/ext/sockets/sockets.c
@@ -57,6 +57,7 @@
#endif
ZEND_DECLARE_MODULE_GLOBALS(sockets)
+static PHP_GINIT_FUNCTION(sockets);
#ifndef MSG_WAITALL
#ifdef LINUX
@@ -159,7 +160,11 @@ zend_module_entry sockets_module_entry = {
PHP_RSHUTDOWN(sockets),
PHP_MINFO(sockets),
NO_VERSION_YET,
- STANDARD_MODULE_PROPERTIES
+ PHP_MODULE_GLOBALS(sockets),
+ PHP_GINIT(sockets),
+ NULL,
+ NULL,
+ STANDARD_MODULE_PROPERTIES_EX
};
@@ -432,7 +437,7 @@ static int php_set_inet_addr(struct sockaddr_in *sin, char *string, php_socket *
return 1;
}
-static void php_sockets_init_globals(zend_sockets_globals *sockets_globals TSRMLS_DC)
+static PHP_GINIT_FUNCTION(sockets)
{
sockets_globals->last_error = 0;
sockets_globals->strerror_buf = NULL;
@@ -444,8 +449,6 @@ PHP_MINIT_FUNCTION(sockets)
{
struct protoent *pe;
- ZEND_INIT_MODULE_GLOBALS(sockets, php_sockets_init_globals, NULL);
-
le_socket = zend_register_list_destructors_ex(php_destroy_socket, NULL, le_socket_name, module_number);
REGISTER_LONG_CONSTANT("AF_UNIX", AF_UNIX, CONST_CS | CONST_PERSISTENT);
diff --git a/ext/spl/php_spl.c b/ext/spl/php_spl.c
index fce87de40c..07dff83fd9 100755
--- a/ext/spl/php_spl.c
+++ b/ext/spl/php_spl.c
@@ -50,9 +50,9 @@ zend_function_entry spl_functions_none[] = {
};
/* }}} */
-/* {{{ spl_init_globals
+/* {{{ PHP_GINIT_FUNCTION
*/
-static void spl_init_globals(zend_spl_globals *spl_globals)
+static PHP_GINIT_FUNCTION(spl)
{
spl_globals->autoload_extensions = NULL;
spl_globals->autoload_functions = NULL;
@@ -645,8 +645,6 @@ zend_function_entry spl_functions[] = {
*/
PHP_MINIT_FUNCTION(spl)
{
- ZEND_INIT_MODULE_GLOBALS(spl, spl_init_globals, NULL);
-
PHP_MINIT(spl_iterators)(INIT_FUNC_ARGS_PASSTHRU);
PHP_MINIT(spl_array)(INIT_FUNC_ARGS_PASSTHRU);
PHP_MINIT(spl_directory)(INIT_FUNC_ARGS_PASSTHRU);
@@ -704,7 +702,11 @@ zend_module_entry spl_module_entry = {
PHP_RSHUTDOWN(spl),
PHP_MINFO(spl),
"0.2",
- STANDARD_MODULE_PROPERTIES
+ PHP_MODULE_GLOBALS(spl),
+ PHP_GINIT(spl),
+ NULL,
+ NULL,
+ STANDARD_MODULE_PROPERTIES_EX
};
/* }}} */
diff --git a/ext/sqlite/sqlite.c b/ext/sqlite/sqlite.c
index 73a57c91ca..c499fa530c 100644
--- a/ext/sqlite/sqlite.c
+++ b/ext/sqlite/sqlite.c
@@ -62,6 +62,7 @@ extern pdo_driver_t pdo_sqlite2_driver;
#endif
ZEND_DECLARE_MODULE_GLOBALS(sqlite)
+static PHP_GINIT_FUNCTION(sqlite);
#if HAVE_PHP_SESSION && !defined(COMPILE_DL_SESSION)
extern ps_module ps_mod_sqlite;
@@ -300,7 +301,15 @@ zend_module_entry sqlite_module_entry = {
#if ZEND_MODULE_API_NO >= 20010901
PHP_SQLITE_MODULE_VERSION,
#endif
+#if ZEND_MODULE_API_NO >= 20060613
+ PHP_MODULE_GLOBALS(sqlite),
+ PHP_GINIT(sqlite),
+ NULL,
+ NULL,
+ STANDARD_MODULE_PROPERTIES_EX
+#else
STANDARD_MODULE_PROPERTIES
+#endif
};
@@ -1016,10 +1025,9 @@ zend_object_iterator *sqlite_get_iterator(zend_class_entry *ce, zval *object, in
}
/* }}} */
-static int init_sqlite_globals(zend_sqlite_globals *g)
+static PHP_GINIT_FUNCTION(sqlite)
{
- g->assoc_case = 0;
- return SUCCESS;
+ sqlite_globals->assoc_case = 0;
}
PHP_MINIT_FUNCTION(sqlite)
@@ -1051,8 +1059,6 @@ PHP_MINIT_FUNCTION(sqlite)
sqlite_ce_query->get_iterator = sqlite_get_iterator;
sqlite_ce_query->iterator_funcs.funcs = &sqlite_query_iterator_funcs;
- ZEND_INIT_MODULE_GLOBALS(sqlite, init_sqlite_globals, NULL);
-
REGISTER_INI_ENTRIES();
#if HAVE_PHP_SESSION && !defined(COMPILE_DL_SESSION)
diff --git a/ext/sybase_ct/php_sybase_ct.c b/ext/sybase_ct/php_sybase_ct.c
index f74cfbeae5..36afda4221 100644
--- a/ext/sybase_ct/php_sybase_ct.c
+++ b/ext/sybase_ct/php_sybase_ct.c
@@ -37,6 +37,10 @@ static int le_link, le_plink, le_result;
#if HAVE_SYBASE_CT
+ZEND_DECLARE_MODULE_GLOBALS(sybase)
+static PHP_GINIT_FUNCTION(sybase);
+static PHP_GSHUTDOWN_FUNCTION(sybase);
+
zend_function_entry sybase_functions[] = {
PHP_FE(sybase_connect, NULL)
PHP_FE(sybase_pconnect, NULL)
@@ -93,10 +97,21 @@ zend_function_entry sybase_functions[] = {
zend_module_entry sybase_module_entry = {
STANDARD_MODULE_HEADER,
- "sybase_ct", sybase_functions, PHP_MINIT(sybase), PHP_MSHUTDOWN(sybase), PHP_RINIT(sybase), PHP_RSHUTDOWN(sybase), PHP_MINFO(sybase), NO_VERSION_YET, STANDARD_MODULE_PROPERTIES
+ "sybase_ct",
+ sybase_functions,
+ PHP_MINIT(sybase),
+ PHP_MSHUTDOWN(sybase),
+ PHP_RINIT(sybase),
+ PHP_RSHUTDOWN(sybase),
+ PHP_MINFO(sybase),
+ NO_VERSION_YET,
+ PHP_MODULE_GLOBALS(sybase),
+ PHP_GINIT(sybase),
+ PHP_GSHUTDOWN(sybase),
+ NULL,
+ STANDARD_MODULE_PROPERTIES_EX
};
-ZEND_DECLARE_MODULE_GLOBALS(sybase)
/* static CS_CONTEXT *context; */
#ifdef COMPILE_DL_SYBASE_CT
@@ -356,7 +371,7 @@ PHP_INI_BEGIN()
PHP_INI_END()
-static void php_sybase_init_globals(zend_sybase_globals *sybase_globals)
+static PHP_GINIT_FUNCTION(sybase)
{
long opt;
TSRMLS_FETCH();
@@ -407,7 +422,7 @@ static void php_sybase_init_globals(zend_sybase_globals *sybase_globals)
}
-static void php_sybase_destroy_globals(zend_sybase_globals *sybase_globals)
+static PHP_GSHUTDOWN_FUNCTION(sybase)
{
ct_exit(sybase_globals->context, CS_UNUSED);
cs_ctx_drop(sybase_globals->context);
@@ -415,8 +430,6 @@ static void php_sybase_destroy_globals(zend_sybase_globals *sybase_globals)
PHP_MINIT_FUNCTION(sybase)
{
- ZEND_INIT_MODULE_GLOBALS(sybase, php_sybase_init_globals, php_sybase_destroy_globals);
-
REGISTER_INI_ENTRIES();
le_link = zend_register_list_destructors_ex(_close_sybase_link, NULL, "sybase-ct link", module_number);
@@ -442,11 +455,6 @@ PHP_RINIT_FUNCTION(sybase)
PHP_MSHUTDOWN_FUNCTION(sybase)
{
UNREGISTER_INI_ENTRIES();
-#ifdef ZTS
- ts_free_id(sybase_globals_id);
-#else
- php_sybase_destroy_globals(&sybase_globals TSRMLS_CC);
-#endif
#if 0
ct_exit(context, CS_UNUSED);
cs_ctx_drop(context);
diff --git a/ext/tidy/tidy.c b/ext/tidy/tidy.c
index 31d09b4a82..40f4ff567b 100644
--- a/ext/tidy/tidy.c
+++ b/ext/tidy/tidy.c
@@ -331,7 +331,11 @@ zend_module_entry tidy_module_entry = {
NULL,
PHP_MINFO(tidy),
PHP_TIDY_MODULE_VERSION,
- STANDARD_MODULE_PROPERTIES
+ PHP_MODULE_GLOBALS(tidy),
+ NULL,
+ NULL,
+ NULL,
+ STANDARD_MODULE_PROPERTIES_EX
};
#ifdef COMPILE_DL_TIDY
@@ -957,20 +961,8 @@ static int php_tidy_parse_string(PHPTidyObj *obj, char *string, int len, char *e
return SUCCESS;
}
-static void tidy_globals_ctor(void *global TSRMLS_DC)
-{
-
-}
-
-static void tidy_globals_dtor(void *global TSRMLS_DC)
-{
-
-}
-
PHP_MINIT_FUNCTION(tidy)
{
- ZEND_INIT_MODULE_GLOBALS(tidy, tidy_globals_ctor, tidy_globals_dtor);
-
REGISTER_INI_ENTRIES();
REGISTER_TIDY_CLASS(tidy, doc, NULL, 0);
REGISTER_TIDY_CLASS(tidyNode, node, NULL, ZEND_ACC_FINAL_CLASS);
@@ -1002,11 +994,6 @@ PHP_RINIT_FUNCTION(tidy)
PHP_MSHUTDOWN_FUNCTION(tidy)
{
-#ifdef ZTS
- ts_free_id(tidy_globals_id);
-#else
- tidy_globals_dtor(&tidy_globals TSRMLS_CC);
-#endif
UNREGISTER_INI_ENTRIES();
return SUCCESS;
}
diff --git a/ext/tokenizer/tokenizer.c b/ext/tokenizer/tokenizer.c
index b5103142f5..8a6b94cdd5 100644
--- a/ext/tokenizer/tokenizer.c
+++ b/ext/tokenizer/tokenizer.c
@@ -144,10 +144,10 @@ PHP_INI_END()
*/
/* }}} */
-/* {{{ php_tokenizer_init_globals
+/* {{{ PHP_GINIT_FUNCTION
*/
/* Uncomment this function if you have INI entries
-static void php_tokenizer_init_globals(zend_tokenizer_globals *tokenizer_globals)
+static PHP_GINIT_FUNCTION(tokenizer)
{
tokenizer_globals->global_value = 0;
tokenizer_globals->global_string = NULL;
@@ -160,7 +160,6 @@ static void php_tokenizer_init_globals(zend_tokenizer_globals *tokenizer_globals
PHP_MINIT_FUNCTION(tokenizer)
{
/* If you have INI entries, uncomment these lines
- ZEND_INIT_MODULE_GLOBALS(tokenizer, php_tokenizer_init_globals, NULL);
REGISTER_INI_ENTRIES();
*/
diff --git a/ext/xml/php_xml.h b/ext/xml/php_xml.h
index a46a20d465..aa778cf825 100644
--- a/ext/xml/php_xml.h
+++ b/ext/xml/php_xml.h
@@ -45,9 +45,9 @@ extern zend_module_entry xml_module_entry;
#error "UTF-16 Unicode support not implemented!"
#endif
-typedef struct {
+ZEND_BEGIN_MODULE_GLOBALS(xml)
XML_Char *default_encoding;
-} php_xml_globals;
+ZEND_END_MODULE_GLOBALS(xml)
typedef struct {
int index;
@@ -147,7 +147,7 @@ PHPAPI char *xml_utf8_decode(const XML_Char *, int, int *, const XML_Char *);
#define phpext_xml_ptr xml_module_ptr
#ifdef ZTS
-#define XML(v) TSRMG(xml_globals_id, php_xml_globals *, v)
+#define XML(v) TSRMG(xml_globals_id, zend_xml_globals *, v)
#else
#define XML(v) (xml_globals.v)
#endif
diff --git a/ext/xml/xml.c b/ext/xml/xml.c
index 7279b04f73..8b26f5fe12 100644
--- a/ext/xml/xml.c
+++ b/ext/xml/xml.c
@@ -57,11 +57,7 @@
* - Weird things happen with <![CDATA[]]> sections.
*/
-#ifdef ZTS
-int xml_globals_id;
-#else
-PHP_XML_API php_xml_globals xml_globals;
-#endif
+ZEND_DECLARE_MODULE_GLOBALS(xml)
/* {{{ dynamically loadable module stuff */
#ifdef COMPILE_DL_XML
@@ -75,6 +71,7 @@ ZEND_GET_MODULE(xml)
/* {{{ function prototypes */
PHP_MINIT_FUNCTION(xml);
PHP_MINFO_FUNCTION(xml);
+static PHP_GINIT_FUNCTION(xml);
static void xml_parser_dtor(zend_rsrc_list_entry *rsrc TSRMLS_DC);
static void xml_set_handler(zval **, zval **);
@@ -161,7 +158,11 @@ zend_module_entry xml_module_entry = {
NULL, /* per-request shutdown function */
PHP_MINFO(xml), /* information function */
NO_VERSION_YET,
- STANDARD_MODULE_PROPERTIES
+ PHP_MODULE_GLOBALS(xml), /* globals descriptor */
+ PHP_GINIT(xml), /* globals ctor */
+ NULL, /* globals dtor */
+ NULL, /* post deactivate */
+ STANDARD_MODULE_PROPERTIES_EX
};
/* All the encoding functions are set to NULL right now, since all
@@ -182,12 +183,10 @@ static int le_xml_parser;
/* }}} */
/* {{{ startup, shutdown and info functions */
-#ifdef ZTS
-static void php_xml_init_globals(php_xml_globals *xml_globals_p TSRMLS_DC)
+static PHP_GINIT_FUNCTION(xml)
{
- XML(default_encoding) = "UTF-8";
+ xml_globals->default_encoding = "UTF-8";
}
-#endif
static void *php_xml_malloc_wrapper(size_t sz)
{
@@ -210,12 +209,6 @@ PHP_MINIT_FUNCTION(xml)
{
le_xml_parser = zend_register_list_destructors_ex(xml_parser_dtor, NULL, "xml", module_number);
-#ifdef ZTS
- ts_allocate_id(&xml_globals_id, sizeof(php_xml_globals), (ts_allocate_ctor) php_xml_init_globals, NULL);
-#else
- XML(default_encoding) = "UTF-8";
-#endif
-
REGISTER_LONG_CONSTANT("XML_ERROR_NONE", XML_ERROR_NONE, CONST_CS|CONST_PERSISTENT);
REGISTER_LONG_CONSTANT("XML_ERROR_NO_MEMORY", XML_ERROR_NO_MEMORY, CONST_CS|CONST_PERSISTENT);
REGISTER_LONG_CONSTANT("XML_ERROR_SYNTAX", XML_ERROR_SYNTAX, CONST_CS|CONST_PERSISTENT);
diff --git a/ext/zlib/zlib.c b/ext/zlib/zlib.c
index 11c20e0914..d50dcf148b 100644
--- a/ext/zlib/zlib.c
+++ b/ext/zlib/zlib.c
@@ -113,6 +113,8 @@ zend_function_entry php_zlib_functions[] = {
};
/* }}} */
+ZEND_DECLARE_MODULE_GLOBALS(zlib)
+
/* {{{ php_zlib_module_entry
*/
zend_module_entry php_zlib_module_entry = {
@@ -125,12 +127,14 @@ zend_module_entry php_zlib_module_entry = {
NULL,
PHP_MINFO(zlib),
"1.1",
- STANDARD_MODULE_PROPERTIES
+ PHP_MODULE_GLOBALS(zlib),
+ NULL,
+ NULL,
+ NULL,
+ STANDARD_MODULE_PROPERTIES_EX
};
/* }}} */
-ZEND_DECLARE_MODULE_GLOBALS(zlib)
-
#ifdef COMPILE_DL_ZLIB
ZEND_GET_MODULE(php_zlib)
#endif
@@ -199,22 +203,10 @@ PHP_INI_BEGIN()
STD_PHP_INI_ENTRY("zlib.output_handler", "", PHP_INI_ALL, OnUpdate_zlib_output_handler, output_handler, zend_zlib_globals, zlib_globals)
PHP_INI_END()
-#ifdef ZTS
-/* {{{ php_zlib_init_globals
- */
-static void php_zlib_init_globals(zend_zlib_globals *zlib_globals_p TSRMLS_DC)
-{
-}
-/* }}} */
-#endif
-
/* {{{ PHP_MINIT_FUNCTION
*/
PHP_MINIT_FUNCTION(zlib)
{
-#ifdef ZTS
- ts_allocate_id(&zlib_globals_id, sizeof(zend_zlib_globals), (ts_allocate_ctor) php_zlib_init_globals, NULL);
-#endif
php_register_url_stream_wrapper("compress.zlib", &php_stream_gzip_wrapper TSRMLS_CC);
php_stream_filter_register_factory("zlib.*", &php_zlib_filter_factory TSRMLS_CC);