Skip to content

Commit

Permalink
made ZEND_TSRMLS_CACHE_* macros look like function calls
Browse files Browse the repository at this point in the history
which also comply with the current semantics for such macros
  • Loading branch information
weltling committed Feb 16, 2015
1 parent 812c0c0 commit af3ca74
Show file tree
Hide file tree
Showing 63 changed files with 109 additions and 109 deletions.
12 changes: 6 additions & 6 deletions TSRM/TSRM.h
Original file line number Diff line number Diff line change
Expand Up @@ -168,9 +168,9 @@ TSRM_API void *tsrm_get_ls_cache(void);
#define TSRMG(id, type, element) (((type) (*((void ***) tsrm_get_ls_cache()))[TSRM_UNSHUFFLE_RSRC_ID(id)])->element)

#define TSRMG_STATIC(id, type, element) (((type) (*((void ***) TSRMLS_CACHE))[TSRM_UNSHUFFLE_RSRC_ID(id)])->element)
#define TSRMLS_CACHE_EXTERN extern TSRM_TLS void *TSRMLS_CACHE
#define TSRMLS_CACHE_DEFINE TSRM_TLS void *TSRMLS_CACHE = NULL
#define TSRMLS_CACHE_UPDATE if (!TSRMLS_CACHE) TSRMLS_CACHE = tsrm_get_ls_cache()
#define TSRMLS_CACHE_EXTERN() extern TSRM_TLS void *TSRMLS_CACHE
#define TSRMLS_CACHE_DEFINE() TSRM_TLS void *TSRMLS_CACHE = NULL
#define TSRMLS_CACHE_UPDATE() if (!TSRMLS_CACHE) TSRMLS_CACHE = tsrm_get_ls_cache()
#define TSRMLS_CACHE _tsrm_ls_cache

/* BC only */
Expand All @@ -191,9 +191,9 @@ TSRM_API void *tsrm_get_ls_cache(void);
#define TSRMLS_SET_CTX(ctx)

#define TSRMG_STATIC(id, type, element)
#define TSRMLS_CACHE_EXTERN
#define TSRMLS_CACHE_DEFINE
#define TSRMLS_CACHE_UPDATE
#define TSRMLS_CACHE_EXTERN()
#define TSRMLS_CACHE_DEFINE()
#define TSRMLS_CACHE_UPDATE()
#define TSRMLS_CACHE

/* BC only */
Expand Down
2 changes: 1 addition & 1 deletion TSRM/tsrm_win32.c
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ static tsrm_win32_globals win32_globals;
static void tsrm_win32_ctor(tsrm_win32_globals *globals)
{
#ifdef ZTS
TSRMLS_CACHE_UPDATE;
TSRMLS_CACHE_UPDATE();
#endif
globals->process = NULL;
globals->shm = NULL;
Expand Down
2 changes: 1 addition & 1 deletion TSRM/tsrm_win32.h
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ typedef struct {

#ifdef ZTS
# define TWG(v) TSRMG_STATIC(win32_globals_id, tsrm_win32_globals *, v)
TSRMLS_CACHE_EXTERN;
TSRMLS_CACHE_EXTERN();
#else
# define TWG(v) (win32_globals.v)
#endif
Expand Down
6 changes: 3 additions & 3 deletions Zend/zend.c
Original file line number Diff line number Diff line change
Expand Up @@ -120,7 +120,7 @@ static HashTable *global_class_table = NULL;
static HashTable *global_constants_table = NULL;
static HashTable *global_auto_globals_table = NULL;
static HashTable *global_persistent_list = NULL;
ZEND_TSRMLS_CACHE_DEFINE;
ZEND_TSRMLS_CACHE_DEFINE();
#endif

ZEND_API zend_utility_values zend_uv;
Expand Down Expand Up @@ -465,7 +465,7 @@ static void compiler_globals_dtor(zend_compiler_globals *compiler_globals) /* {{

static void executor_globals_ctor(zend_executor_globals *executor_globals) /* {{{ */
{
ZEND_TSRMLS_CACHE_UPDATE;
ZEND_TSRMLS_CACHE_UPDATE();
zend_startup_constants();
zend_copy_constants(EG(zend_constants), GLOBAL_CONSTANTS_TABLE);
zend_init_rsrc_plist();
Expand Down Expand Up @@ -564,7 +564,7 @@ int zend_startup(zend_utility_functions *utility_functions, char **extensions) /
zend_executor_globals *executor_globals;
extern ZEND_API ts_rsrc_id ini_scanner_globals_id;
extern ZEND_API ts_rsrc_id language_scanner_globals_id;
ZEND_TSRMLS_CACHE_UPDATE;
ZEND_TSRMLS_CACHE_UPDATE();
#else
extern zend_ini_scanner_globals ini_scanner_globals;
extern zend_php_scanner_globals language_scanner_globals;
Expand Down
14 changes: 7 additions & 7 deletions Zend/zend.h
Original file line number Diff line number Diff line change
Expand Up @@ -62,19 +62,19 @@

#ifdef ZEND_ENABLE_STATIC_TSRMLS_CACHE
#define ZEND_TSRMG TSRMG_STATIC
#define ZEND_TSRMLS_CACHE_EXTERN TSRMLS_CACHE_EXTERN
#define ZEND_TSRMLS_CACHE_DEFINE TSRMLS_CACHE_DEFINE
#define ZEND_TSRMLS_CACHE_UPDATE TSRMLS_CACHE_UPDATE
#define ZEND_TSRMLS_CACHE_EXTERN() TSRMLS_CACHE_EXTERN()
#define ZEND_TSRMLS_CACHE_DEFINE() TSRMLS_CACHE_DEFINE()
#define ZEND_TSRMLS_CACHE_UPDATE() TSRMLS_CACHE_UPDATE()
#define ZEND_TSRMLS_CACHE TSRMLS_CACHE
#else
#define ZEND_TSRMG TSRMG
#define ZEND_TSRMLS_CACHE_EXTERN
#define ZEND_TSRMLS_CACHE_DEFINE
#define ZEND_TSRMLS_CACHE_UPDATE
#define ZEND_TSRMLS_CACHE_EXTERN()
#define ZEND_TSRMLS_CACHE_DEFINE()
#define ZEND_TSRMLS_CACHE_UPDATE()
#define ZEND_TSRMLS_CACHE
#endif

ZEND_TSRMLS_CACHE_EXTERN;
ZEND_TSRMLS_CACHE_EXTERN();

#ifdef HAVE_NORETURN
# ifdef ZEND_NORETRUN_ALIAS
Expand Down
2 changes: 1 addition & 1 deletion Zend/zend_alloc.c
Original file line number Diff line number Diff line change
Expand Up @@ -2388,7 +2388,7 @@ static void alloc_globals_ctor(zend_alloc_globals *alloc_globals)
return;
}
#endif
ZEND_TSRMLS_CACHE_UPDATE;
ZEND_TSRMLS_CACHE_UPDATE();
alloc_globals->mm_heap = zend_mm_init();
}

Expand Down
4 changes: 2 additions & 2 deletions ext/bcmath/bcmath.c
Original file line number Diff line number Diff line change
Expand Up @@ -128,7 +128,7 @@ zend_module_entry bcmath_module_entry = {

#ifdef COMPILE_DL_BCMATH
#ifdef ZTS
ZEND_TSRMLS_CACHE_DEFINE;
ZEND_TSRMLS_CACHE_DEFINE();
#endif
ZEND_GET_MODULE(bcmath)
#endif
Expand All @@ -144,7 +144,7 @@ PHP_INI_END()
static PHP_GINIT_FUNCTION(bcmath)
{
#if defined(COMPILE_DL_BCMATH) && defined(ZTS)
ZEND_TSRMLS_CACHE_UPDATE;
ZEND_TSRMLS_CACHE_UPDATE();
#endif
bcmath_globals->bc_precision = 0;
bc_init_numbers();
Expand Down
2 changes: 1 addition & 1 deletion ext/bcmath/php_bcmath.h
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ ZEND_END_MODULE_GLOBALS(bcmath)
#ifdef ZTS
# define BCG(v) ZEND_TSRMG(bcmath_globals_id, zend_bcmath_globals *, v)
# ifdef COMPILE_DL_BCMATH
ZEND_TSRMLS_CACHE_EXTERN;
ZEND_TSRMLS_CACHE_EXTERN();
# endif
#else
# define BCG(v) (bcmath_globals.v)
Expand Down
4 changes: 2 additions & 2 deletions ext/com_dotnet/com_extension.c
Original file line number Diff line number Diff line change
Expand Up @@ -255,7 +255,7 @@ zend_module_entry com_dotnet_module_entry = {

#ifdef COMPILE_DL_COM_DOTNET
#ifdef ZTS
ZEND_TSRMLS_CACHE_DEFINE;
ZEND_TSRMLS_CACHE_DEFINE();
#endif
ZEND_GET_MODULE(com_dotnet)
#endif
Expand Down Expand Up @@ -341,7 +341,7 @@ PHP_INI_END()
static PHP_GINIT_FUNCTION(com_dotnet)
{
#if defined(COMPILE_DL_COM_DOTNET) && defined(ZTS)
ZEND_TSRMLS_CACHE_UPDATE;
ZEND_TSRMLS_CACHE_UPDATE();
#endif
memset(com_dotnet_globals, 0, sizeof(*com_dotnet_globals));
com_dotnet_globals->code_page = CP_ACP;
Expand Down
2 changes: 1 addition & 1 deletion ext/com_dotnet/php_com_dotnet.h
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ ZEND_END_MODULE_GLOBALS(com_dotnet)
#ifdef ZTS
# define COMG(v) ZEND_TSRMG(com_dotnet_globals_id, zend_com_dotnet_globals *, v)
# ifdef COMPILE_DL_COM_DOTNET
ZEND_TSRMLS_CACHE_EXTERN;
ZEND_TSRMLS_CACHE_EXTERN();
# endif
#else
# define COMG(v) (com_dotnet_globals.v)
Expand Down
4 changes: 2 additions & 2 deletions ext/exif/exif.c
Original file line number Diff line number Diff line change
Expand Up @@ -158,7 +158,7 @@ ZEND_DECLARE_MODULE_GLOBALS(exif)
#ifdef ZTS
#define EXIF_G(v) ZEND_TSRMG(exif_globals_id, zend_exif_globals *, v)
#ifdef COMPILE_DL_EXIF
ZEND_TSRMLS_CACHE_DEFINE;
ZEND_TSRMLS_CACHE_DEFINE();
#endif
#else
#define EXIF_G(v) (exif_globals.v)
Expand Down Expand Up @@ -212,7 +212,7 @@ PHP_INI_END()
static PHP_GINIT_FUNCTION(exif)
{
#if defined(COMPILE_DL_EXIF) && defined(ZTS)
ZEND_TSRMLS_CACHE_UPDATE;
ZEND_TSRMLS_CACHE_UPDATE();
#endif
exif_globals->encode_unicode = NULL;
exif_globals->decode_unicode_be = NULL;
Expand Down
4 changes: 2 additions & 2 deletions ext/filter/filter.c
Original file line number Diff line number Diff line change
Expand Up @@ -154,7 +154,7 @@ zend_module_entry filter_module_entry = {

#ifdef COMPILE_DL_FILTER
#ifdef ZTS
ZEND_TSRMLS_CACHE_DEFINE;
ZEND_TSRMLS_CACHE_DEFINE();
#endif
ZEND_GET_MODULE(filter)
#endif
Expand Down Expand Up @@ -196,7 +196,7 @@ PHP_INI_END()
static void php_filter_init_globals(zend_filter_globals *filter_globals) /* {{{ */
{
#if defined(COMPILE_DL_FILTER) && defined(ZTS)
ZEND_TSRMLS_CACHE_UPDATE;
ZEND_TSRMLS_CACHE_UPDATE();
#endif
ZVAL_UNDEF(&filter_globals->post_array);
ZVAL_UNDEF(&filter_globals->get_array);
Expand Down
2 changes: 1 addition & 1 deletion ext/filter/php_filter.h
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ ZEND_END_MODULE_GLOBALS(filter)

#ifdef ZTS
#define IF_G(v) ZEND_TSRMG(filter_globals_id, zend_filter_globals *, v)
ZEND_TSRMLS_CACHE_EXTERN;
ZEND_TSRMLS_CACHE_EXTERN();
#else
#define IF_G(v) (filter_globals.v)
#endif
Expand Down
4 changes: 2 additions & 2 deletions ext/gmp/gmp.c
Original file line number Diff line number Diff line change
Expand Up @@ -215,7 +215,7 @@ zend_module_entry gmp_module_entry = {

#ifdef COMPILE_DL_GMP
#ifdef ZTS
ZEND_TSRMLS_CACHE_DEFINE;
ZEND_TSRMLS_CACHE_DEFINE();
#endif
ZEND_GET_MODULE(gmp)
#endif
Expand Down Expand Up @@ -630,7 +630,7 @@ static int gmp_unserialize(zval *object, zend_class_entry *ce, const unsigned ch
static ZEND_GINIT_FUNCTION(gmp)
{
#if defined(COMPILE_DL_GMP) && defined(ZTS)
ZEND_TSRMLS_CACHE_UPDATE;
ZEND_TSRMLS_CACHE_UPDATE();
#endif
gmp_globals->rand_initialized = 0;
}
Expand Down
2 changes: 1 addition & 1 deletion ext/gmp/php_gmp.h
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,7 @@ ZEND_END_MODULE_GLOBALS(gmp)
#ifdef ZTS
#define GMPG(v) ZEND_TSRMG(gmp_globals_id, zend_gmp_globals *, v)
#ifdef COMPILE_DL_GMP
ZEND_TSRMLS_CACHE_EXTERN;
ZEND_TSRMLS_CACHE_EXTERN();
#endif
#else
#define GMPG(v) (gmp_globals.v)
Expand Down
4 changes: 2 additions & 2 deletions ext/iconv/iconv.c
Original file line number Diff line number Diff line change
Expand Up @@ -165,7 +165,7 @@ zend_module_entry iconv_module_entry = {

#ifdef COMPILE_DL_ICONV
#ifdef ZTS
ZEND_TSRMLS_CACHE_DEFINE;
ZEND_TSRMLS_CACHE_DEFINE();
#endif
ZEND_GET_MODULE(iconv)
#endif
Expand All @@ -174,7 +174,7 @@ ZEND_GET_MODULE(iconv)
static PHP_GINIT_FUNCTION(iconv)
{
#if defined(COMPILE_DL_ICONV) && defined(ZTS)
ZEND_TSRMLS_CACHE_UPDATE;
ZEND_TSRMLS_CACHE_UPDATE();
#endif
iconv_globals->input_encoding = NULL;
iconv_globals->output_encoding = NULL;
Expand Down
2 changes: 1 addition & 1 deletion ext/iconv/php_iconv.h
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ ZEND_END_MODULE_GLOBALS(iconv)
#ifdef ZTS
# define ICONVG(v) ZEND_TSRMG(iconv_globals_id, zend_iconv_globals *, v)
# ifdef COMPILE_DL_ICONV
ZEND_TSRMLS_CACHE_EXTERN;
ZEND_TSRMLS_CACHE_EXTERN();
# endif
#else
# define ICONVG(v) (iconv_globals.v)
Expand Down
2 changes: 1 addition & 1 deletion ext/interbase/php_ibase_includes.h
Original file line number Diff line number Diff line change
Expand Up @@ -134,7 +134,7 @@ enum php_interbase_option {
#ifdef ZTS
# define IBG(v) ZEND_TSRMG(ibase_globals_id, zend_ibase_globals *, v)
# ifdef COMPILE_DL_INTERBASE
ZEND_TSRMLS_CACHE_EXTERN;
ZEND_TSRMLS_CACHE_EXTERN();
# endif
#else
#define IBG(v) (ibase_globals.v)
Expand Down
4 changes: 2 additions & 2 deletions ext/intl/php_intl.c
Original file line number Diff line number Diff line change
Expand Up @@ -895,7 +895,7 @@ zend_module_entry intl_module_entry = {

#ifdef COMPILE_DL_INTL
#ifdef ZTS
ZEND_TSRMLS_CACHE_DEFINE;
ZEND_TSRMLS_CACHE_DEFINE();
#endif
ZEND_GET_MODULE( intl )
#endif
Expand All @@ -904,7 +904,7 @@ ZEND_GET_MODULE( intl )
static PHP_GINIT_FUNCTION(intl)
{
#if defined(COMPILE_DL_INTL) && defined(ZTS)
ZEND_TSRMLS_CACHE_UPDATE;
ZEND_TSRMLS_CACHE_UPDATE();
#endif
memset( intl_globals, 0, sizeof(zend_intl_globals) );
}
Expand Down
2 changes: 1 addition & 1 deletion ext/intl/php_intl.h
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ ZEND_END_MODULE_GLOBALS(intl)
#ifdef ZTS
#define INTL_G(v) ZEND_TSRMG(intl_globals_id, zend_intl_globals *, v)
#ifdef COMPILE_DL_INTL
ZEND_TSRMLS_CACHE_EXTERN;
ZEND_TSRMLS_CACHE_EXTERN();
#endif
#else
#define INTL_G(v) (intl_globals.v)
Expand Down
4 changes: 2 additions & 2 deletions ext/json/json.c
Original file line number Diff line number Diff line change
Expand Up @@ -134,7 +134,7 @@ static PHP_MINIT_FUNCTION(json)
static PHP_GINIT_FUNCTION(json)
{
#if defined(COMPILE_DL_JSON) && defined(ZTS)
ZEND_TSRMLS_CACHE_UPDATE;
ZEND_TSRMLS_CACHE_UPDATE();
#endif
json_globals->encoder_depth = 0;
json_globals->error_code = 0;
Expand Down Expand Up @@ -165,7 +165,7 @@ zend_module_entry json_module_entry = {

#ifdef COMPILE_DL_JSON
#ifdef ZTS
ZEND_TSRMLS_CACHE_DEFINE;
ZEND_TSRMLS_CACHE_DEFINE();
#endif
ZEND_GET_MODULE(json)
#endif
Expand Down
4 changes: 2 additions & 2 deletions ext/libxml/libxml.c
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ static zend_class_entry *libxmlerror_class_entry;
/* {{{ dynamically loadable module stuff */
#ifdef COMPILE_DL_LIBXML
#ifdef ZTS
ZEND_TSRMLS_CACHE_DEFINE;
ZEND_TSRMLS_CACHE_DEFINE();
#endif
ZEND_GET_MODULE(libxml)
#endif /* COMPILE_DL_LIBXML */
Expand Down Expand Up @@ -272,7 +272,7 @@ static void php_libxml_node_free_list(xmlNodePtr node)
static PHP_GINIT_FUNCTION(libxml)
{
#if defined(COMPILE_DL_LIBXML) && defined(ZTS)
ZEND_TSRMLS_CACHE_UPDATE;
ZEND_TSRMLS_CACHE_UPDATE();
#endif
ZVAL_UNDEF(&libxml_globals->stream_context);
libxml_globals->error_buffer.s = NULL;
Expand Down
2 changes: 1 addition & 1 deletion ext/libxml/php_libxml.h
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,7 @@ PHP_LIBXML_API void php_libxml_shutdown(void);
#ifdef ZTS
#define LIBXML(v) ZEND_TSRMG(libxml_globals_id, zend_libxml_globals *, v)
#ifdef COMPILE_DL_LIBXML
ZEND_TSRMLS_CACHE_EXTERN;
ZEND_TSRMLS_CACHE_EXTERN();
#endif
#else
#define LIBXML(v) (libxml_globals.v)
Expand Down
4 changes: 2 additions & 2 deletions ext/mbstring/mbstring.c
Original file line number Diff line number Diff line change
Expand Up @@ -598,7 +598,7 @@ static sapi_post_entry php_post_entries[] = {

#ifdef COMPILE_DL_MBSTRING
#ifdef ZTS
ZEND_TSRMLS_CACHE_DEFINE;
ZEND_TSRMLS_CACHE_DEFINE();
#endif
ZEND_GET_MODULE(mbstring)
#endif
Expand Down Expand Up @@ -1495,7 +1495,7 @@ PHP_INI_END()
static PHP_GINIT_FUNCTION(mbstring)
{
#if defined(COMPILE_DL_MBSTRING) && defined(ZTS)
ZEND_TSRMLS_CACHE_UPDATE;
ZEND_TSRMLS_CACHE_UPDATE();
#endif

mbstring_globals->language = mbfl_no_language_uni;
Expand Down
2 changes: 1 addition & 1 deletion ext/mbstring/mbstring.h
Original file line number Diff line number Diff line change
Expand Up @@ -201,7 +201,7 @@ struct mb_overload_def {

#ifdef ZTS
#define MBSTRG(v) ZEND_TSRMG(mbstring_globals_id, zend_mbstring_globals *, v)
ZEND_TSRMLS_CACHE_EXTERN;
ZEND_TSRMLS_CACHE_EXTERN();
#else
#define MBSTRG(v) (mbstring_globals.v)
#endif
Expand Down
4 changes: 2 additions & 2 deletions ext/mysql/php_mysql.c
Original file line number Diff line number Diff line change
Expand Up @@ -353,7 +353,7 @@ zend_module_entry mysql_module_entry = {

#ifdef COMPILE_DL_MYSQL
#ifdef ZTS
ZEND_TSRMLS_CACHE_DEFINE;
ZEND_TSRMLS_CACHE_DEFINE();
#endif
ZEND_GET_MODULE(mysql)
#endif
Expand Down Expand Up @@ -516,7 +516,7 @@ PHP_INI_END()
static PHP_GINIT_FUNCTION(mysql)
{
#if defined(COMPILE_DL_MYSQL) && defined(ZTS)
ZEND_TSRMLS_CACHE_UPDATE;
ZEND_TSRMLS_CACHE_UPDATE();
#endif
mysql_globals->num_persistent = 0;
mysql_globals->default_socket = NULL;
Expand Down
2 changes: 1 addition & 1 deletion ext/mysql/php_mysql_structs.h
Original file line number Diff line number Diff line change
Expand Up @@ -129,7 +129,7 @@ ZEND_END_MODULE_GLOBALS(mysql)
#ifdef ZTS
# define MySG(v) ZEND_TSRMG(mysql_globals_id, zend_mysql_globals *, v)
# ifdef COMPILE_DL_MYSQL
ZEND_TSRMLS_CACHE_EXTERN;
ZEND_TSRMLS_CACHE_EXTERN();
# endif
#else
# define MySG(v) (mysql_globals.v)
Expand Down
Loading

0 comments on commit af3ca74

Please sign in to comment.