summaryrefslogtreecommitdiff
path: root/main
diff options
context:
space:
mode:
authorkrakjoe <joe.watkins@live.co.uk>2014-09-20 20:22:14 +0100
committerkrakjoe <joe.watkins@live.co.uk>2014-09-20 20:22:14 +0100
commitb3aebda9eaf55706af2e21178f229a171725a168 (patch)
tree9aa1794dc4b513d5c0077adcbeb89fa215f181a4 /main
parent763bfb4f3b0e66d5a961f9f367aa86e9f9da262e (diff)
downloadphp-git-b3aebda9eaf55706af2e21178f229a171725a168.tar.gz
native tls initial patch
Diffstat (limited to 'main')
-rw-r--r--main/SAPI.c4
-rw-r--r--main/SAPI.h2
-rw-r--r--main/main.c9
-rw-r--r--main/output.c2
-rw-r--r--main/php.h2
-rw-r--r--main/php_globals.h2
-rw-r--r--main/php_output.h1
7 files changed, 11 insertions, 11 deletions
diff --git a/main/SAPI.c b/main/SAPI.c
index 50ea8c0a16..f00e3c728b 100644
--- a/main/SAPI.c
+++ b/main/SAPI.c
@@ -52,7 +52,7 @@
#include "php_content_types.h"
#ifdef ZTS
-SAPI_API int sapi_globals_id;
+TSRMG_D(sapi_globals_struct, sapi_globals_id);
#else
sapi_globals_struct sapi_globals;
#endif
@@ -88,7 +88,7 @@ SAPI_API void sapi_startup(sapi_module_struct *sf)
sapi_module = *sf;
#ifdef ZTS
- ts_allocate_id(&sapi_globals_id, sizeof(sapi_globals_struct), (ts_allocate_ctor) sapi_globals_ctor, (ts_allocate_dtor) sapi_globals_dtor);
+ TSRMG_ALLOCATE(sapi_globals_id, sizeof(sapi_globals_struct), (ts_allocate_ctor) sapi_globals_ctor, (ts_allocate_dtor) sapi_globals_dtor);
# ifdef PHP_WIN32
_configthreadlocale(_ENABLE_PER_THREAD_LOCALE);
# endif
diff --git a/main/SAPI.h b/main/SAPI.h
index 79661371d9..4e2b4cd420 100644
--- a/main/SAPI.h
+++ b/main/SAPI.h
@@ -143,7 +143,7 @@ typedef struct _sapi_globals_struct {
BEGIN_EXTERN_C()
#ifdef ZTS
# define SG(v) TSRMG(sapi_globals_id, sapi_globals_struct *, v)
-SAPI_API extern int sapi_globals_id;
+TSRMG_DH(sapi_globals_struct, sapi_globals_id);
#else
# define SG(v) (sapi_globals.v)
extern SAPI_API sapi_globals_struct sapi_globals;
diff --git a/main/main.c b/main/main.c
index 63144de418..2a78d4b0d2 100644
--- a/main/main.c
+++ b/main/main.c
@@ -124,7 +124,7 @@ PHPAPI int (*php_register_internal_extensions_func)(TSRMLS_D) = php_register_int
#ifndef ZTS
php_core_globals core_globals;
#else
-PHPAPI int core_globals_id;
+TSRMG_D(php_core_globals, core_globals_id);
#endif
#ifdef PHP_WIN32
@@ -2048,7 +2048,6 @@ int php_module_startup(sapi_module_struct *sf, zend_module_entry *additional_mod
zend_module_entry *module;
#ifdef ZTS
zend_executor_globals *executor_globals;
- void ***tsrm_ls;
php_core_globals *core_globals;
#endif
@@ -2073,7 +2072,7 @@ int php_module_startup(sapi_module_struct *sf, zend_module_entry *additional_mod
#endif
#ifdef ZTS
- tsrm_ls = ts_resource(0);
+ TSRMLS_INIT();
#endif
#ifdef PHP_WIN32
@@ -2112,10 +2111,10 @@ int php_module_startup(sapi_module_struct *sf, zend_module_entry *additional_mod
#ifdef ZTS
executor_globals = ts_resource(executor_globals_id);
- ts_allocate_id(&core_globals_id, sizeof(php_core_globals), (ts_allocate_ctor) core_globals_ctor, (ts_allocate_dtor) core_globals_dtor);
+ TSRMG_ALLOCATE(core_globals_id, sizeof(php_core_globals), (ts_allocate_ctor) core_globals_ctor, (ts_allocate_dtor) core_globals_dtor);
core_globals = ts_resource(core_globals_id);
#ifdef PHP_WIN32
- ts_allocate_id(&php_win32_core_globals_id, sizeof(php_win32_core_globals), (ts_allocate_ctor) php_win32_core_globals_ctor, (ts_allocate_dtor) php_win32_core_globals_dtor);
+ TSRMG_ALLOCATE(php_win32_core_globals_id, sizeof(php_win32_core_globals), (ts_allocate_ctor) php_win32_core_globals_ctor, (ts_allocate_dtor) php_win32_core_globals_dtor);
#endif
#else
php_startup_ticks(TSRMLS_C);
diff --git a/main/output.c b/main/output.c
index f44ae178b4..65c8152bc0 100644
--- a/main/output.c
+++ b/main/output.c
@@ -160,7 +160,7 @@ PHPAPI void php_output_shutdown(void)
PHPAPI int php_output_activate(TSRMLS_D)
{
#ifdef ZTS
- memset((*((void ***) tsrm_ls))[TSRM_UNSHUFFLE_RSRC_ID(output_globals_id)], 0, sizeof(zend_output_globals));
+ //memset((*((void ***) tsrm_ls))[TSRM_UNSHUFFLE_RSRC_ID(output_globals_id)], 0, sizeof(zend_output_globals));
#else
memset(&output_globals, 0, sizeof(zend_output_globals));
#endif
diff --git a/main/php.h b/main/php.h
index 2a683e1924..224a65dd82 100644
--- a/main/php.h
+++ b/main/php.h
@@ -301,7 +301,7 @@ static inline ZEND_ATTRIBUTE_DEPRECATED void php_std_error_handling() {}
PHPAPI void php_verror(const char *docref, const char *params, int type, const char *format, va_list args TSRMLS_DC) PHP_ATTRIBUTE_FORMAT(printf, 4, 0);
-#ifdef ZTS
+#ifdef PASS_TSRMLS
#define PHP_ATTR_FMT_OFFSET 1
#else
#define PHP_ATTR_FMT_OFFSET 0
diff --git a/main/php_globals.h b/main/php_globals.h
index a60efe69de..0e088d20f0 100644
--- a/main/php_globals.h
+++ b/main/php_globals.h
@@ -27,7 +27,7 @@ typedef struct _php_core_globals php_core_globals;
#ifdef ZTS
# define PG(v) TSRMG(core_globals_id, php_core_globals *, v)
-extern PHPAPI int core_globals_id;
+TSRMG_DH(php_core_globals, core_globals_id);
#else
# define PG(v) (core_globals.v)
extern ZEND_API struct _php_core_globals core_globals;
diff --git a/main/php_output.h b/main/php_output.h
index 02b2b85d13..d3c3e072d0 100644
--- a/main/php_output.h
+++ b/main/php_output.h
@@ -153,6 +153,7 @@ ZEND_END_MODULE_GLOBALS(output)
/* there should not be a need to use OG() from outside of output.c */
#ifdef ZTS
+TSRMG_DH(php_output_globals, output_globals_id);
# define OG(v) TSRMG(output_globals_id, zend_output_globals *, v)
#else
# define OG(v) (output_globals.v)