diff options
author | Anatol Belski <ab@php.net> | 2014-10-16 18:50:19 +0200 |
---|---|---|
committer | Anatol Belski <ab@php.net> | 2014-10-16 18:50:19 +0200 |
commit | aac7b1db7c9df59ffb0860de7692c653719cf4d0 (patch) | |
tree | 1fe1bdc2ffc380a0eaeea069ed5cbb0176eb7715 | |
parent | 073c79b8b539fbbfc540db1cb1a15dfba5358f24 (diff) | |
download | php-git-aac7b1db7c9df59ffb0860de7692c653719cf4d0.tar.gz |
converted ext/sqlite and ext/pdo_mysql to use static tsrmls cache
-rwxr-xr-x | ext/pdo_mysql/config.m4 | 2 | ||||
-rw-r--r-- | ext/pdo_mysql/config.w32 | 2 | ||||
-rw-r--r-- | ext/pdo_mysql/pdo_mysql.c | 6 | ||||
-rw-r--r-- | ext/pdo_mysql/php_pdo_mysql_int.h | 5 | ||||
-rw-r--r-- | ext/sqlite3/config.w32 | 2 | ||||
-rw-r--r-- | ext/sqlite3/config0.m4 | 2 | ||||
-rw-r--r-- | ext/sqlite3/php_sqlite3.h | 3 | ||||
-rw-r--r-- | ext/sqlite3/sqlite3.c | 6 |
8 files changed, 23 insertions, 5 deletions
diff --git a/ext/pdo_mysql/config.m4 b/ext/pdo_mysql/config.m4 index f237f413be..95ae6ca7ed 100755 --- a/ext/pdo_mysql/config.m4 +++ b/ext/pdo_mysql/config.m4 @@ -144,7 +144,7 @@ if test "$PHP_PDO_MYSQL" != "no"; then fi dnl fix after renaming to pdo_mysql - PHP_NEW_EXTENSION(pdo_mysql, pdo_mysql.c mysql_driver.c mysql_statement.c, $ext_shared,,-I$pdo_cv_inc_path -I) + PHP_NEW_EXTENSION(pdo_mysql, pdo_mysql.c mysql_driver.c mysql_statement.c, $ext_shared,,-I$pdo_cv_inc_path -I -DZEND_ENABLE_STATIC_TSRMLS_CACHE=1) ifdef([PHP_ADD_EXTENSION_DEP], [ PHP_ADD_EXTENSION_DEP(pdo_mysql, pdo) diff --git a/ext/pdo_mysql/config.w32 b/ext/pdo_mysql/config.w32 index da085dc569..f150916b2a 100644 --- a/ext/pdo_mysql/config.w32 +++ b/ext/pdo_mysql/config.w32 @@ -12,7 +12,7 @@ if (PHP_PDO_MYSQL != "no") { } else { if (CHECK_LIB("libmysql.lib", "pdo_mysql", PHP_PDO_MYSQL) && CHECK_HEADER_ADD_INCLUDE("mysql.h", "CFLAGS_PDO_MYSQL", PHP_PHP_BUILD + "\\include\\mysql;" + PHP_PDO_MYSQL)) { - EXTENSION("pdo_mysql", "pdo_mysql.c mysql_driver.c mysql_statement.c"); + EXTENSION("pdo_mysql", "pdo_mysql.c mysql_driver.c mysql_statement.c", null, "/DZEND_ENABLE_STATIC_TSRMLS_CACHE=1"); } else { WARNING("pdo_mysql not enabled; libraries and headers not found"); } diff --git a/ext/pdo_mysql/pdo_mysql.c b/ext/pdo_mysql/pdo_mysql.c index d9c04470a4..82dbdbc83a 100644 --- a/ext/pdo_mysql/pdo_mysql.c +++ b/ext/pdo_mysql/pdo_mysql.c @@ -32,6 +32,9 @@ #include "php_pdo_mysql_int.h" #ifdef COMPILE_DL_PDO_MYSQL +#ifdef ZTS +ZEND_TSRMLS_CACHE_DEFINE; +#endif ZEND_GET_MODULE(pdo_mysql) #endif @@ -206,6 +209,9 @@ static PHP_RSHUTDOWN_FUNCTION(pdo_mysql) */ static PHP_GINIT_FUNCTION(pdo_mysql) { +#if defined(COMPILE_DL_PDO_MYSQL) && defined(ZTS) +ZEND_TSRMLS_CACHE_UPDATE; +#endif #ifndef PHP_WIN32 pdo_mysql_globals->default_socket = NULL; #endif diff --git a/ext/pdo_mysql/php_pdo_mysql_int.h b/ext/pdo_mysql/php_pdo_mysql_int.h index f6cdb0a8f2..accac8a25e 100644 --- a/ext/pdo_mysql/php_pdo_mysql_int.h +++ b/ext/pdo_mysql/php_pdo_mysql_int.h @@ -83,7 +83,10 @@ ZEND_END_MODULE_GLOBALS(pdo_mysql) ZEND_EXTERN_MODULE_GLOBALS(pdo_mysql) #ifdef ZTS -#define PDO_MYSQL_G(v) TSRMG(pdo_mysql_globals_id, zend_pdo_mysql_globals *, v) +#define PDO_MYSQL_G(v) ZEND_TSRMG(pdo_mysql_globals_id, zend_pdo_mysql_globals *, v) +# ifdef COMPILE_DL_PDO_MYSQL +ZEND_TSRMLS_CACHE_EXTERN; +# endif #else #define PDO_MYSQL_G(v) (pdo_mysql_globals.v) #endif diff --git a/ext/sqlite3/config.w32 b/ext/sqlite3/config.w32 index 8ddb6b9ac8..60dd2fae52 100644 --- a/ext/sqlite3/config.w32 +++ b/ext/sqlite3/config.w32 @@ -5,7 +5,7 @@ ARG_WITH("sqlite3", "SQLite 3 support", "no"); if (PHP_SQLITE3 != "no") { ADD_FLAG("CFLAGS_SQLITE3", "/D SQLITE_THREADSAFE=" + (PHP_ZTS == "yes" ? "1" : "0") + " /D SQLITE_ENABLE_FTS3=1 /D SQLITE_ENABLE_COLUMN_METADATA=1 /D SQLITE_CORE=1 /D SQLITE_API=__declspec(dllexport) "); - EXTENSION("sqlite3", "sqlite3.c", null, "/I" + configure_module_dirname + "/libsqlite /I" + configure_module_dirname); + EXTENSION("sqlite3", "sqlite3.c", null, "/I" + configure_module_dirname + "/libsqlite /I" + configure_module_dirname + " /DZEND_ENABLE_STATIC_TSRMLS_CACHE=1"); ADD_SOURCES(configure_module_dirname + "/libsqlite", "sqlite3.c", "sqlite3"); diff --git a/ext/sqlite3/config0.m4 b/ext/sqlite3/config0.m4 index 6959a6f916..bbb1133fe4 100644 --- a/ext/sqlite3/config0.m4 +++ b/ext/sqlite3/config0.m4 @@ -8,7 +8,7 @@ PHP_ARG_WITH(sqlite3, whether to enable the SQLite3 extension, if test $PHP_SQLITE3 != "no"; then sqlite3_extra_sources="" - PHP_SQLITE3_CFLAGS="" + PHP_SQLITE3_CFLAGS=" -DZEND_ENABLE_STATIC_TSRMLS_CACHE=1 " dnl when running phpize enable_maintainer_zts is not available if test -z "$enable_maintainer_zts"; then diff --git a/ext/sqlite3/php_sqlite3.h b/ext/sqlite3/php_sqlite3.h index 5c7dfcfa5a..8f1c500211 100644 --- a/ext/sqlite3/php_sqlite3.h +++ b/ext/sqlite3/php_sqlite3.h @@ -32,6 +32,9 @@ ZEND_END_MODULE_GLOBALS(sqlite3) #ifdef ZTS # define SQLITE3G(v) TSRMG(sqlite3_globals_id, zend_sqlite3_globals *, v) +# ifdef COMPILE_DL_SQLITE3 +ZEND_TSRMLS_CACHE_EXTERN; +# endif #else # define SQLITE3G(v) (sqlite3_globals.v) #endif diff --git a/ext/sqlite3/sqlite3.c b/ext/sqlite3/sqlite3.c index af3dec0681..a98b303547 100644 --- a/ext/sqlite3/sqlite3.c +++ b/ext/sqlite3/sqlite3.c @@ -2271,6 +2271,9 @@ PHP_MINFO_FUNCTION(sqlite3) */ static PHP_GINIT_FUNCTION(sqlite3) { +#if defined(COMPILE_DL_SQLITE3) && defined(ZTS) + ZEND_TSRMLS_CACHE_UPDATE; +#endif memset(sqlite3_globals, 0, sizeof(*sqlite3_globals)); } /* }}} */ @@ -2296,6 +2299,9 @@ zend_module_entry sqlite3_module_entry = { /* }}} */ #ifdef COMPILE_DL_SQLITE3 +#ifdef ZTS +ZEND_TSRMLS_CACHE_DEFINE; +#endif ZEND_GET_MODULE(sqlite3) #endif |