Skip to content

Commit 7f1107d

Browse files
committed
converted ext/ereg, ext/phar and ext/pgsql for static tsrmls usage
1 parent 0e7682c commit 7f1107d

File tree

11 files changed

+28
-9
lines changed

11 files changed

+28
-9
lines changed

ext/ereg/config.w32

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
ARG_WITH("ereg", "POSIX extended regular expressions", "yes");
55
if (PHP_EREG != "no") {
66

7-
EXTENSION("ereg", "ereg.c", PHP_EREG_SHARED, "-Dregexec=php_regexec -Dregerror=php_regerror -Dregfree=php_regfree -Dregcomp=php_regcomp -Iext/ereg/regex");
7+
EXTENSION("ereg", "ereg.c", PHP_EREG_SHARED, "-Dregexec=php_regexec -Dregerror=php_regerror -Dregfree=php_regfree -Dregcomp=php_regcomp -Iext/ereg/regex /DZEND_ENABLE_STATIC_TSRMLS_CACHE=1");
88
ADD_SOURCES("ext/ereg/regex", "regcomp.c regexec.c regerror.c regfree.c", "ereg");
99
AC_DEFINE('REGEX', 1, 'Bundled regex');
1010
AC_DEFINE('HSREGEX', 1, 'Bundled regex');

ext/ereg/config0.m4

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,7 @@ if test "$REGEX_TYPE" = "php"; then
3333
ereg_regex_headers="regex/"
3434
PHP_EREG_CFLAGS="-Dregexec=php_regexec -Dregerror=php_regerror -Dregfree=php_regfree -Dregcomp=php_regcomp"
3535
fi
36+
PHP_EREG_CFLAGS="$PHP_EREG_CFLAGS -DZEND_ENABLE_STATIC_TSRMLS_CACHE=1"
3637

3738
PHP_NEW_EXTENSION(ereg, ereg.c $ereg_regex_sources, no,,$PHP_EREG_CFLAGS)
3839
PHP_INSTALL_HEADERS([ext/ereg], [php_ereg.h php_regex.h $ereg_regex_headers])

ext/ereg/php_ereg.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ ZEND_END_MODULE_GLOBALS(ereg)
5454
PHP_MINFO_FUNCTION(ereg);
5555

5656
#ifdef ZTS
57-
#define EREG(v) TSRMG(ereg_globals_id, zend_ereg_globals *, v)
57+
#define EREG(v) ZEND_TSRMG(ereg_globals_id, zend_ereg_globals *, v)
5858
#else
5959
#define EREG(v) (ereg_globals.v)
6060
#endif

ext/pgsql/config.m4

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -105,7 +105,7 @@ if test "$PHP_PGSQL" != "no"; then
105105

106106
PHP_ADD_INCLUDE($PGSQL_INCLUDE)
107107

108-
PHP_NEW_EXTENSION(pgsql, pgsql.c, $ext_shared)
108+
PHP_NEW_EXTENSION(pgsql, pgsql.c, $ext_shared, -DZEND_ENABLE_STATIC_TSRMLS_CACHE=1)
109109
fi
110110

111111

ext/pgsql/config.w32

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ ARG_WITH("pgsql", "PostgreSQL support", "no");
66
if (PHP_PGSQL != "no") {
77
if (CHECK_LIB("libpq.lib", "pgsql", PHP_PGSQL) &&
88
CHECK_HEADER_ADD_INCLUDE("libpq-fe.h", "CFLAGS_PGSQL", PHP_PGSQL + "\\include;" + PHP_PHP_BUILD + "\\include\\pgsql;" + PHP_PHP_BUILD + "\\include\\libpq;" + PHP_PGSQL)) {
9-
EXTENSION("pgsql", "pgsql.c");
9+
EXTENSION("pgsql", "pgsql.c", PHP_PGSQL_SHARED, "/DZEND_ENABLE_STATIC_TSRMLS_CACHE=1");
1010
AC_DEFINE('HAVE_PGSQL', 1, 'Have PostgreSQL library');
1111
ADD_FLAG("CFLAGS_PGSQL", "/D HAVE_PG_CONFIG_H /D PGSQL_EXPORTS /D HAVE_PQSETNONBLOCKING /D HAVE_PQCMDTUPLES /D HAVE_PQCLIENTENCODING /D HAVE_PQESCAPE /D HAVE_PQPARAMETERSTATUS /D HAVE_PGTRANSACTIONSTATUS /D HAVE_PQEXECPARAMS /D HAVE_PQPREPARE /D HAVE_PQEXECPREPARED /D HAVE_PQRESULTERRORFIELD /D HAVE_PQSENDQUERYPARAMS /D HAVE_PQSENDPREPARE /D HAVE_PQSENDQUERYPREPARED /D HAVE_PQPUTCOPYDATA /D HAVE_PQPUTCOPYEND /D HAVE_PQGETCOPYDATA /D HAVE_PQSETERRORVERBOSITY /D HAVE_PQUNESCAPEBYTEA /D HAVE_PQFTABLE /D HAVE_PQESCAPE_CONN /D HAVE_PQESCAPE_BYTEA_CONN /D HAVE_PQFREEMEM /D HAVE_PGSQL_WITH_MULTIBYTE_SUPPORT /D HAVE_PQPROTOCOLVERSION /D HAVE_PG_LO_CREATE /D HAVE_PG_LO_IMPORT_WITH_OID /D HAVE_PG_LO_TRUNCATE /D HAVE_PG_LO64 /D HAVE_PQESCAPELITERAL /D HAVE_PQOIDVALUE");
1212
} else {

ext/pgsql/pgsql.c

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -771,6 +771,9 @@ zend_module_entry pgsql_module_entry = {
771771
/* }}} */
772772

773773
#ifdef COMPILE_DL_PGSQL
774+
#ifdef ZTS
775+
ZEND_TSRMLS_CACHE_DEFINE;
776+
#endif
774777
ZEND_GET_MODULE(pgsql)
775778
#endif
776779

@@ -1090,6 +1093,9 @@ PHP_INI_END()
10901093
*/
10911094
static PHP_GINIT_FUNCTION(pgsql)
10921095
{
1096+
#if defined(COMPILE_DL_PGSQL) && defined(ZTS)
1097+
ZEND_TSRMLS_CACHE_UPDATE;
1098+
#endif
10931099
memset(pgsql_globals, 0, sizeof(zend_pgsql_globals));
10941100
/* Initilize notice message hash at MINIT only */
10951101
zend_hash_init_ex(&pgsql_globals->notices, 0, NULL, PHP_PGSQL_NOTICE_PTR_DTOR, 1, 0);

ext/pgsql/php_pgsql.h

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -322,7 +322,10 @@ ZEND_END_MODULE_GLOBALS(pgsql)
322322
ZEND_EXTERN_MODULE_GLOBALS(pgsql)
323323

324324
#ifdef ZTS
325-
# define PGG(v) TSRMG(pgsql_globals_id, zend_pgsql_globals *, v)
325+
# define PGG(v) ZEND_TSRMG(pgsql_globals_id, zend_pgsql_globals *, v)
326+
# ifdef COMPILE_DL_PGSQL
327+
ZEND_TSRMLS_CACHE_EXTERN;
328+
# endif
326329
#else
327330
# define PGG(v) (pgsql_globals.v)
328331
#endif

ext/phar/config.m4

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ PHP_ARG_ENABLE(phar, for phar archive support,
55
[ --disable-phar Disable phar support], yes)
66

77
if test "$PHP_PHAR" != "no"; then
8-
PHP_NEW_EXTENSION(phar, util.c tar.c zip.c stream.c func_interceptors.c dirstream.c phar.c phar_object.c phar_path_check.c, $ext_shared)
8+
PHP_NEW_EXTENSION(phar, util.c tar.c zip.c stream.c func_interceptors.c dirstream.c phar.c phar_object.c phar_path_check.c, $ext_shared, -DZEND_ENABLE_STATIC_TSRMLS_CACHE=1)
99
AC_MSG_CHECKING([for phar openssl support])
1010
if test "$PHP_HASH_SHARED" != "yes"; then
1111
if test "$PHP_HASH" != "no"; then

ext/phar/config.w32

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ if (PHP_PHAR_NATIVE_SSL != "no") {
99
}
1010

1111
if (PHP_PHAR != "no") {
12-
EXTENSION("phar", "dirstream.c func_interceptors.c phar.c phar_object.c phar_path_check.c stream.c tar.c util.c zip.c");
12+
EXTENSION("phar", "dirstream.c func_interceptors.c phar.c phar_object.c phar_path_check.c stream.c tar.c util.c zip.c", PHP_PHAR_SHARED, "/DZEND_ENABLE_STATIC_TSRMLS_CACHE=1");
1313
if (PHP_PHAR_SHARED || (PHP_PHAR_NATIVE_SSL_SHARED && PHP_SNAPSHOT_BUILD == "no")) {
1414
ADD_FLAG("CFLAGS_PHAR", "/D COMPILE_DL_PHAR ");
1515
}

ext/phar/phar.c

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3228,6 +3228,9 @@ int phar_flush(phar_archive_data *phar, char *user_stub, zend_long len, int conv
32283228
/* }}} */
32293229

32303230
#ifdef COMPILE_DL_PHAR
3231+
#ifdef ZTS
3232+
ZEND_TSRMLS_CACHE_DEFINE;
3233+
#endif
32313234
ZEND_GET_MODULE(phar)
32323235
#endif
32333236

@@ -3335,6 +3338,9 @@ static void mime_type_dtor(zval *zv)
33353338

33363339
PHP_GINIT_FUNCTION(phar) /* {{{ */
33373340
{
3341+
#if defined(COMPILE_DL_PHAR) && defined(ZTS)
3342+
ZEND_TSRMLS_CACHE_UPDATE;
3343+
#endif
33383344
phar_mime_type mime;
33393345

33403346
memset(phar_globals, 0, sizeof(zend_phar_globals));

ext/phar/phar_internal.h

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -196,8 +196,11 @@ ZEND_EXTERN_MODULE_GLOBALS(phar)
196196

197197
#ifdef ZTS
198198
# include "TSRM.h"
199-
# define PHAR_G(v) TSRMG(phar_globals_id, zend_phar_globals *, v)
200-
# define PHAR_GLOBALS ((zend_phar_globals *) (*((void ***) tsrm_get_ls_cache()))[TSRM_UNSHUFFLE_RSRC_ID(phar_globals_id)])
199+
# ifdef COMPILE_DL_PHAR
200+
ZEND_TSRMLS_CACHE_EXTERN;
201+
# endif
202+
# define PHAR_G(v) ZEND_TSRMG(phar_globals_id, zend_phar_globals *, v)
203+
# define PHAR_GLOBALS ((zend_phar_globals *) (*((void ***) ZEND_TSRMLS_CACHE))[TSRM_UNSHUFFLE_RSRC_ID(phar_globals_id)])
201204
#else
202205
# define PHAR_G(v) (phar_globals.v)
203206
# define PHAR_GLOBALS (&phar_globals)

0 commit comments

Comments
 (0)