com php-src: integrate static tsrmls cache with ext/mcrypt: ext/mcrypt/config.m4 ext/mcrypt/config.w32 ext/mcrypt/mcrypt.c ext/mcrypt/php_mcrypt.h
| From: | Anatol Belski | Date: | Tue, 11 Aug 2015 10:32:00 +0000 |
| Subject: | com php-src: integrate static tsrmls cache with ext/mcrypt: ext/mcrypt/config.m4 ext/mcrypt/config.w32 ext/mcrypt/mcrypt.c ext/mcrypt/php_mcrypt.h | ||
| Groups: | php.cvs | ||
| Request: | Send a blank email to php-cvs+get-88457@lists.php.net to get a copy of this message | ||
Commit: b0893344df1946c842d06a8d2c576abb4f7c78e7
Author: Anatol Belski <ab@php.net> Tue, 11 Aug 2015 12:32:00 +0200
Parents: f15ec180ade4d6ffc83ca1894ea6b37c2e41299f
Branches: master
Link: http://git.php.net/?p=php-src.git;a=commitdiff;h=b0893344df1946c842d06a8d2c576abb4f7c78e7
Log:
integrate static tsrmls cache with ext/mcrypt
Changed paths:
M ext/mcrypt/config.m4
M ext/mcrypt/config.w32
M ext/mcrypt/mcrypt.c
M ext/mcrypt/php_mcrypt.h
Diff:
diff --git a/ext/mcrypt/config.m4 b/ext/mcrypt/config.m4
index ab954e6...eb55983 100644
--- a/ext/mcrypt/config.m4
+++ b/ext/mcrypt/config.m4
@@ -55,5 +55,5 @@ if test "$PHP_MCRYPT" != "no"; then
PHP_ADD_INCLUDE($MCRYPT_DIR/include)
PHP_SUBST(MCRYPT_SHARED_LIBADD)
- PHP_NEW_EXTENSION(mcrypt, mcrypt.c mcrypt_filter.c, $ext_shared)
+ PHP_NEW_EXTENSION(mcrypt, mcrypt.c mcrypt_filter.c, $ext_shared,,
-DZEND_ENABLE_STATIC_TSRMLS_CACHE=1)
fi
diff --git a/ext/mcrypt/config.w32 b/ext/mcrypt/config.w32
index 8d30db7..169781e 100644
--- a/ext/mcrypt/config.w32
+++ b/ext/mcrypt/config.w32
@@ -10,7 +10,7 @@ if (PHP_MCRYPT != "no") {
CHECK_LIB('Advapi32.lib', 'mcrypt')
) {
- EXTENSION('mcrypt', 'mcrypt.c mcrypt_filter.c', false);
+ EXTENSION('mcrypt', 'mcrypt.c mcrypt_filter.c', false,
"/DZEND_ENABLE_STATIC_TSRMLS_CACHE=1");
AC_DEFINE('HAVE_LIBMCRYPT', 1);
AC_DEFINE('HAVE_LIBMCRYPT24', 1);
} else {
diff --git a/ext/mcrypt/mcrypt.c b/ext/mcrypt/mcrypt.c
index ea26e48..bdb119f 100644
--- a/ext/mcrypt/mcrypt.c
+++ b/ext/mcrypt/mcrypt.c
@@ -272,6 +272,9 @@ zend_module_entry mcrypt_module_entry = {
};
#ifdef COMPILE_DL_MCRYPT
+#ifdef ZTS
+ZEND_TSRMLS_CACHE_DEFINE();
+#endif
ZEND_GET_MODULE(mcrypt)
#endif
@@ -350,6 +353,9 @@ static void php_mcrypt_module_dtor(zend_resource *rsrc) /* {{{ */
static PHP_GINIT_FUNCTION(mcrypt)
{/*{{{*/
+#if defined(COMPILE_DL_MCRYPT) && defined(ZTS)
+ ZEND_TSRMLS_CACHE_UPDATE();
+#endif
mcrypt_globals->fd[RANDOM] = -1;
mcrypt_globals->fd[URANDOM] = -1;
}/*}}}*/
diff --git a/ext/mcrypt/php_mcrypt.h b/ext/mcrypt/php_mcrypt.h
index 1fc9e41..9135f86 100644
--- a/ext/mcrypt/php_mcrypt.h
+++ b/ext/mcrypt/php_mcrypt.h
@@ -83,11 +83,7 @@ ZEND_BEGIN_MODULE_GLOBALS(mcrypt)
int fd[2]; // RANDOM = 0, URANDOM = 1
ZEND_END_MODULE_GLOBALS(mcrypt)
-#ifdef ZTS
-# define MCG(v) TSRMG(mcrypt_globals_id, zend_mcrypt_globals *, v)
-#else
-# define MCG(v) (mcrypt_globals.v)
-#endif
+#define MCG(v) ZEND_MODULE_GLOBALS_ACCESSOR(mcrypt, v)
#else
#define mcrypt_module_ptr NULL