Skip to content

Commit 4e66cce

Browse files
committed
switch to the unified globals accessor where appropriate
1 parent 0615aa8 commit 4e66cce

File tree

25 files changed

+57
-152
lines changed

25 files changed

+57
-152
lines changed

ext/bcmath/php_bcmath.h

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -51,15 +51,11 @@ ZEND_BEGIN_MODULE_GLOBALS(bcmath)
5151
zend_long bc_precision;
5252
ZEND_END_MODULE_GLOBALS(bcmath)
5353

54-
#ifdef ZTS
55-
# define BCG(v) ZEND_TSRMG(bcmath_globals_id, zend_bcmath_globals *, v)
56-
# ifdef COMPILE_DL_BCMATH
54+
#if defined(ZTS) && defined(COMPILE_DL_BCMATH)
5755
ZEND_TSRMLS_CACHE_EXTERN();
58-
# endif
59-
#else
60-
# define BCG(v) (bcmath_globals.v)
6156
#endif
6257

6358
ZEND_EXTERN_MODULE_GLOBALS(bcmath)
59+
#define BCG(v) ZEND_MODULE_GLOBALS_ACCESSOR(bcmath, v)
6460

6561
#endif /* PHP_BCMATH_H */

ext/com_dotnet/php_com_dotnet.h

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -55,16 +55,12 @@ ZEND_BEGIN_MODULE_GLOBALS(com_dotnet)
5555
zend_bool rshutdown_started;
5656
ZEND_END_MODULE_GLOBALS(com_dotnet)
5757

58-
#ifdef ZTS
59-
# define COMG(v) ZEND_TSRMG(com_dotnet_globals_id, zend_com_dotnet_globals *, v)
60-
# ifdef COMPILE_DL_COM_DOTNET
58+
#if defined(ZTS) && defined(COMPILE_DL_COM_DOTNET)
6159
ZEND_TSRMLS_CACHE_EXTERN();
62-
# endif
63-
#else
64-
# define COMG(v) (com_dotnet_globals.v)
6560
#endif
6661

6762
extern ZEND_DECLARE_MODULE_GLOBALS(com_dotnet);
63+
#define COMG(v) ZEND_MODULE_GLOBALS_ACCESSOR(com_dotnet, v)
6864

6965
#endif /* PHP_COM_DOTNET_H */
7066

ext/exif/exif.c

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -152,15 +152,11 @@ ZEND_BEGIN_MODULE_GLOBALS(exif)
152152
ZEND_END_MODULE_GLOBALS(exif)
153153

154154
ZEND_DECLARE_MODULE_GLOBALS(exif)
155+
#define EXIF_G(v) ZEND_MODULE_GLOBALS_ACCESSOR(exif, v)
155156

156-
#ifdef ZTS
157-
#define EXIF_G(v) ZEND_TSRMG(exif_globals_id, zend_exif_globals *, v)
158-
#ifdef COMPILE_DL_EXIF
157+
#if defined(ZTS) && defined(COMPILE_DL_EXIF)
159158
ZEND_TSRMLS_CACHE_DEFINE();
160159
#endif
161-
#else
162-
#define EXIF_G(v) (exif_globals.v)
163-
#endif
164160

165161
/* {{{ PHP_INI
166162
*/

ext/filter/php_filter.h

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -65,13 +65,11 @@ ZEND_BEGIN_MODULE_GLOBALS(filter)
6565
zend_long default_filter_flags;
6666
ZEND_END_MODULE_GLOBALS(filter)
6767

68-
#ifdef ZTS
69-
#define IF_G(v) ZEND_TSRMG(filter_globals_id, zend_filter_globals *, v)
68+
#if defined(COMPILE_DL_FILTER) && defined(ZTS)
7069
ZEND_TSRMLS_CACHE_EXTERN();
71-
#else
72-
#define IF_G(v) (filter_globals.v)
7370
#endif
7471

72+
#define IF_G(v) ZEND_MODULE_GLOBALS_ACCESSOR(filter, v)
7573

7674
#define PHP_INPUT_FILTER_PARAM_DECL zval *value, zend_long flags, zval *option_array, char *charset
7775
void php_filter_int(PHP_INPUT_FILTER_PARAM_DECL);

ext/gmp/php_gmp.h

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -95,14 +95,11 @@ ZEND_BEGIN_MODULE_GLOBALS(gmp)
9595
gmp_randstate_t rand_state;
9696
ZEND_END_MODULE_GLOBALS(gmp)
9797

98-
#ifdef ZTS
99-
#define GMPG(v) ZEND_TSRMG(gmp_globals_id, zend_gmp_globals *, v)
100-
#ifdef COMPILE_DL_GMP
98+
#define GMPG(v) ZEND_MODULE_GLOBALS_ACCESSOR(gmp, v)
99+
100+
#if defined(ZTS) && defined(COMPILE_DL_GMP)
101101
ZEND_TSRMLS_CACHE_EXTERN();
102102
#endif
103-
#else
104-
#define GMPG(v) (gmp_globals.v)
105-
#endif
106103

107104
#else
108105

ext/iconv/php_iconv.h

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -75,13 +75,10 @@ ZEND_BEGIN_MODULE_GLOBALS(iconv)
7575
char *output_encoding;
7676
ZEND_END_MODULE_GLOBALS(iconv)
7777

78-
#ifdef ZTS
79-
# define ICONVG(v) ZEND_TSRMG(iconv_globals_id, zend_iconv_globals *, v)
80-
# ifdef COMPILE_DL_ICONV
78+
#define ICONVG(v) ZEND_MODULE_GLOBALS_ACCESSOR(iconv, v)
79+
80+
#ifdef defined(ZTS) && defined(COMPILE_DL_ICONV)
8181
ZEND_TSRMLS_CACHE_EXTERN();
82-
# endif
83-
#else
84-
# define ICONVG(v) (iconv_globals.v)
8582
#endif
8683

8784
#ifdef HAVE_IBM_ICONV

ext/interbase/php_ibase_includes.h

Lines changed: 2 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -127,17 +127,10 @@ enum php_interbase_option {
127127
PHP_IBASE_NOWAIT = 256
128128
};
129129

130-
#ifdef ZTS
131-
#else
132-
#endif
130+
#define IBG(v) ZEND_MODULE_GLOBALS_ACCESSOR(ibase, v)
133131

134-
#ifdef ZTS
135-
# define IBG(v) ZEND_TSRMG(ibase_globals_id, zend_ibase_globals *, v)
136-
# ifdef COMPILE_DL_INTERBASE
132+
#if defined(ZTS) && defined(COMPILE_DL_INTERBASE)
137133
ZEND_TSRMLS_CACHE_EXTERN();
138-
# endif
139-
#else
140-
#define IBG(v) (ibase_globals.v)
141134
#endif
142135

143136
#define BLOB_ID_LEN 18

ext/intl/php_intl.h

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -55,17 +55,13 @@ ZEND_BEGIN_MODULE_GLOBALS(intl)
5555
zend_bool use_exceptions;
5656
ZEND_END_MODULE_GLOBALS(intl)
5757

58-
/* Macro to access request-wide global variables. */
59-
#ifdef ZTS
60-
#define INTL_G(v) ZEND_TSRMG(intl_globals_id, zend_intl_globals *, v)
61-
#ifdef COMPILE_DL_INTL
58+
#if defined(ZTS) && defined(COMPILE_DL_INTL)
6259
ZEND_TSRMLS_CACHE_EXTERN();
6360
#endif
64-
#else
65-
#define INTL_G(v) (intl_globals.v)
66-
#endif
6761

6862
ZEND_EXTERN_MODULE_GLOBALS(intl)
63+
/* Macro to access request-wide global variables. */
64+
#define INTL_G(v) ZEND_MODULE_GLOBALS_ACCESSOR(intl, v)
6965

7066
PHP_MINIT_FUNCTION(intl);
7167
PHP_MSHUTDOWN_FUNCTION(intl);

ext/json/php_json.h

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -82,14 +82,10 @@ ZEND_BEGIN_MODULE_GLOBALS(json)
8282
ZEND_END_MODULE_GLOBALS(json)
8383

8484
ZEND_EXTERN_MODULE_GLOBALS(json);
85+
#define JSON_G(v) ZEND_MODULE_GLOBALS_ACCESSOR(json, v)
8586

86-
#ifdef ZTS
87-
# define JSON_G(v) ZEND_TSRMG(json_globals_id, zend_json_globals *, v)
88-
# ifdef COMPILE_DL_JSON
89-
ZEND_TSRMLS_CACHE_EXTERN;
90-
# endif
91-
#else
92-
# define JSON_G(v) (json_globals.v)
87+
#if defined(ZTS) && defined(COMPILE_DL_JSON)
88+
ZEND_TSRMLS_CACHE_EXTERN();
9389
#endif
9490

9591
/* json_decode() options */

ext/libxml/php_libxml.h

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -115,14 +115,11 @@ PHP_LIBXML_API zend_bool php_libxml_disable_entity_loader(zend_bool disable);
115115
PHP_LIBXML_API void php_libxml_initialize(void);
116116
PHP_LIBXML_API void php_libxml_shutdown(void);
117117

118-
#ifdef ZTS
119-
#define LIBXML(v) ZEND_TSRMG(libxml_globals_id, zend_libxml_globals *, v)
120-
#ifdef COMPILE_DL_LIBXML
118+
#define LIBXML(v) ZEND_MODULE_GLOBALS_ACCESSOR(libxml, v)
119+
120+
#if defined(ZTS) && defined(COMPILE_DL_LIBXML)
121121
ZEND_TSRMLS_CACHE_EXTERN();
122122
#endif
123-
#else
124-
#define LIBXML(v) (libxml_globals.v)
125-
#endif
126123

127124
#else /* HAVE_LIBXML */
128125
#define libxml_module_ptr NULL

0 commit comments

Comments
 (0)