Eliminate another straight forward TSRMLS_FETCH() in zend_startup_module()

# For THTTPD:
# The code that uses a call to this function is for older versions of PHP anyway so its not covered

# For Zend OpCache:
# Added a new define for 5.6 and wrapped the code around that so its still compatible with older version
This commit is contained in:
Kalle Sommer Nielsen 2013-12-12 20:30:45 +01:00
parent 4411641b1e
commit 0fc8e6af0a
7 changed files with 21 additions and 5 deletions

View File

@ -2313,10 +2313,8 @@ ZEND_API void zend_unregister_functions(const zend_function_entry *functions, in
}
/* }}} */
ZEND_API int zend_startup_module(zend_module_entry *module) /* {{{ */
ZEND_API int zend_startup_module(zend_module_entry *module TSRMLS_DC) /* {{{ */
{
TSRMLS_FETCH();
if ((module = zend_register_internal_module(module TSRMLS_CC)) != NULL && zend_startup_module_ex(module TSRMLS_CC) == SUCCESS) {
return SUCCESS;
}

View File

@ -266,7 +266,7 @@ ZEND_API int zend_parse_parameter(int flags, int arg_num TSRMLS_DC, zval **arg,
ZEND_API int zend_register_functions(zend_class_entry *scope, const zend_function_entry *functions, HashTable *function_table, int type TSRMLS_DC);
ZEND_API void zend_unregister_functions(const zend_function_entry *functions, int count, HashTable *function_table TSRMLS_DC);
ZEND_API int zend_startup_module(zend_module_entry *module_entry);
ZEND_API int zend_startup_module(zend_module_entry *module_entry TSRMLS_DC);
ZEND_API zend_module_entry* zend_register_internal_module(zend_module_entry *module_entry TSRMLS_DC);
ZEND_API zend_module_entry* zend_register_module_ex(zend_module_entry *module TSRMLS_DC);
ZEND_API int zend_startup_module_ex(zend_module_entry *module TSRMLS_DC);

View File

@ -2528,7 +2528,11 @@ static int accel_startup(zend_extension *extension)
_setmaxstdio(2048); /* The default configuration is limited to 512 stdio files */
#endif
#if ZEND_EXTENSION_API_NO > PHP_5_6_X_API_NO
if (start_accel_module(TSRMLS_C) == FAILURE) {
#else
if (start_accel_module() == FAILURE) {
#endif
accel_startup_ok = 0;
zend_error(E_WARNING, ACCELERATOR_PRODUCT_NAME ": module registration failed!");
return FAILURE;

View File

@ -92,6 +92,7 @@
#define PHP_5_3_X_API_NO 220090626
#define PHP_5_4_X_API_NO 220100525
#define PHP_5_5_X_API_NO 220121212
#define PHP_5_6_X_API_NO 220131106
/*** file locking ***/
#ifndef ZEND_WIN32

View File

@ -468,10 +468,17 @@ static zend_module_entry accel_module_entry = {
STANDARD_MODULE_PROPERTIES
};
#if ZEND_EXTENSION_API_NO > PHP_5_6_X_API_NO
int start_accel_module(TSRMLS_D)
{
return zend_startup_module(&accel_module_entry TSRMLS_CC);
}
#else
int start_accel_module(void)
{
return zend_startup_module(&accel_module_entry);
}
#endif
/* {{{ proto array accelerator_get_scripts()
Get the scripts which are accelerated by ZendAccelerator */

View File

@ -22,7 +22,12 @@
#ifndef ZEND_ACCELERATOR_MODULE_H
#define ZEND_ACCELERATOR_MODULE_H
#if ZEND_EXTENSION_API_NO > PHP_5_6_X_API_NO
int start_accel_module(TSRMLS_D);
#else
int start_accel_module(void);
#endif
void zend_accel_override_file_functions(TSRMLS_D);
#endif /* _ZEND_ACCELERATOR_MODULE_H */

View File

@ -349,11 +349,12 @@ static zend_module_entry php_thttpd_module = {
STANDARD_MODULE_PROPERTIES
};
static int php_thttpd_startup(sapi_module_struct *sapi_module)
static int php_thttpd_startup(sapi_module_struct *sapi_module TSRMLS_DC)
{
#if PHP_API_VERSION >= 20020918
if (php_module_startup(sapi_module, &php_thttpd_module, 1) == FAILURE) {
#else
/* No TSRMLS_CC here to zend_startup_module() as 5.6 and older does not have that parameter */
if (php_module_startup(sapi_module) == FAILURE
|| zend_startup_module(&php_thttpd_module) == FAILURE) {
#endif