summaryrefslogtreecommitdiff
path: root/ext/json
diff options
context:
space:
mode:
authorAnatol Belski <ab@php.net>2014-10-17 14:16:40 +0200
committerAnatol Belski <ab@php.net>2014-10-17 14:16:40 +0200
commitfea10f6a5e5ff4d22adea5fd04476a88d4f76db8 (patch)
treeaeb75efdddd8ae643662c88bef39faafacc8130a /ext/json
parent83b8e281dba11f4a037dd5977812f84661fe895e (diff)
downloadphp-git-fea10f6a5e5ff4d22adea5fd04476a88d4f76db8.tar.gz
ext/iconv, ext/json and ext/session use static tsrmls pointer
Diffstat (limited to 'ext/json')
-rw-r--r--ext/json/config.m42
-rw-r--r--ext/json/config.w322
-rw-r--r--ext/json/json.c6
-rw-r--r--ext/json/php_json.h5
4 files changed, 12 insertions, 3 deletions
diff --git a/ext/json/config.m4 b/ext/json/config.m4
index 26c43a0e3f..6861a62a1f 100644
--- a/ext/json/config.m4
+++ b/ext/json/config.m4
@@ -9,7 +9,7 @@ if test "$PHP_JSON" != "no"; then
AC_DEFINE([HAVE_JSON],1 ,[whether to enable JavaScript Object Serialization support])
AC_HEADER_STDC
- PHP_NEW_EXTENSION(json, json.c utf8_decode.c JSON_parser.c, $ext_shared)
+ PHP_NEW_EXTENSION(json, json.c utf8_decode.c JSON_parser.c, $ext_shared, -DZEND_ENABLE_STATIC_TSRMLS_CACHE=1)
PHP_INSTALL_HEADERS([ext/json], [php_json.h])
PHP_SUBST(JSON_SHARED_LIBADD)
fi
diff --git a/ext/json/config.w32 b/ext/json/config.w32
index cedbf42829..60ccf91630 100644
--- a/ext/json/config.w32
+++ b/ext/json/config.w32
@@ -4,7 +4,7 @@
ARG_ENABLE("json", "JavaScript Object Serialization support", "yes");
if (PHP_JSON != "no") {
- EXTENSION('json', 'json.c', PHP_JSON_SHARED, "");
+ EXTENSION('json', 'json.c', PHP_JSON_SHARED, "/DZEND_ENABLE_STATIC_TSRMLS_CACHE=1");
ADD_SOURCES(configure_module_dirname, "JSON_parser.c utf8_decode.c", "json");
PHP_INSTALL_HEADERS("ext/json/", "php_json.h");
}
diff --git a/ext/json/json.c b/ext/json/json.c
index 8f4f281ef1..91bedcace9 100644
--- a/ext/json/json.c
+++ b/ext/json/json.c
@@ -125,6 +125,9 @@ static PHP_MINIT_FUNCTION(json)
*/
static PHP_GINIT_FUNCTION(json)
{
+#if defined(COMPILE_DL_JSON) && defined(ZTS)
+ ZEND_TSRMLS_CACHE_UPDATE;
+#endif
json_globals->encoder_depth = 0;
json_globals->error_code = 0;
json_globals->encode_max_depth = 0;
@@ -153,6 +156,9 @@ zend_module_entry json_module_entry = {
/* }}} */
#ifdef COMPILE_DL_JSON
+#ifdef ZTS
+ZEND_TSRMLS_CACHE_DEFINE;
+#endif
ZEND_GET_MODULE(json)
#endif
diff --git a/ext/json/php_json.h b/ext/json/php_json.h
index 5b2dc127dd..64ad811bc7 100644
--- a/ext/json/php_json.h
+++ b/ext/json/php_json.h
@@ -44,7 +44,10 @@ ZEND_BEGIN_MODULE_GLOBALS(json)
ZEND_END_MODULE_GLOBALS(json)
#ifdef ZTS
-# define JSON_G(v) TSRMG(json_globals_id, zend_json_globals *, v)
+# define JSON_G(v) ZEND_TSRMG(json_globals_id, zend_json_globals *, v)
+# ifdef COMPILE_DL_JSON
+ZEND_TSRMLS_CACHE_EXTERN;
+# endif
#else
# define JSON_G(v) (json_globals.v)
#endif