com php-src: Eliminate another straight forward TSRMLS_FETCH () in zend_startup_module(): Zend/zend_AP I.c Zend/zend_API.h
ext/opcache/ZendAccelerator.c ext/opcache/ZendAccelerator.h ext/opcache/zend_acceler ator_module.c ext/opcache/zend_accelerator_module.h
sapi/thttpd/thttpd.c

From: Date: Thu, 12 Dec 2013 19:30:45 +0000
Subject: com php-src: Eliminate another straight forward TSRMLS_FETCH () in zend_startup_module(): Zend/zend_AP I.c Zend/zend_API.h
ext/opcache/ZendAccelerator.c ext/opcache/ZendAccelerator.h ext/opcache/zend_acceler ator_module.c ext/opcache/zend_accelerator_module.h
sapi/thttpd/thttpd.c
Groups: php.cvs 
Request: Send a blank email to php-cvs+get-74396@lists.php.net to get a copy of this message
Commit: 0fc8e6af0a0ff8eeb15746978ce1e6009ed76f11 Author: Kalle Sommer Nielsen <kalle@php.net> Thu, 12 Dec 2013 20:30:45 +0100 Parents: 4411641b1eba09fa8afe5b38af9be2ba49a51db4 Branches: master Link: http://git.php.net/?p=php-src.git;a=commitdiff;h=0fc8e6af0a0ff8eeb15746978ce1e6009ed76f11 Log: 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 Changed paths: M Zend/zend_API.c M Zend/zend_API.h M ext/opcache/ZendAccelerator.c M ext/opcache/ZendAccelerator.h M ext/opcache/zend_accelerator_module.c M ext/opcache/zend_accelerator_module.h M sapi/thttpd/thttpd.c Diff: diff --git a/Zend/zend_API.c b/Zend/zend_API.c index 18f151e..b3f59a7 100644 --- a/Zend/zend_API.c +++ b/Zend/zend_API.c @@ -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; } diff --git a/Zend/zend_API.h b/Zend/zend_API.h index 007d989..c426acf 100644 --- a/Zend/zend_API.h +++ b/Zend/zend_API.h @@ -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); diff --git a/ext/opcache/ZendAccelerator.c b/ext/opcache/ZendAccelerator.c index 9398b58..69a5d38 100644 --- a/ext/opcache/ZendAccelerator.c +++ b/ext/opcache/ZendAccelerator.c @@ -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; diff --git a/ext/opcache/ZendAccelerator.h b/ext/opcache/ZendAccelerator.h index 487010b..7ffd012 100644 --- a/ext/opcache/ZendAccelerator.h +++ b/ext/opcache/ZendAccelerator.h @@ -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 diff --git a/ext/opcache/zend_accelerator_module.c b/ext/opcache/zend_accelerator_module.c index cd840fd..1034e3e 100644 --- a/ext/opcache/zend_accelerator_module.c +++ b/ext/opcache/zend_accelerator_module.c @@ -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 */ diff --git a/ext/opcache/zend_accelerator_module.h b/ext/opcache/zend_accelerator_module.h index 539b4e8..74728f3 100644 --- a/ext/opcache/zend_accelerator_module.h +++ b/ext/opcache/zend_accelerator_module.h @@ -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 */ diff --git a/sapi/thttpd/thttpd.c b/sapi/thttpd/thttpd.c index 548bcda..b136b71 100644 --- a/sapi/thttpd/thttpd.c +++ b/sapi/thttpd/thttpd.c @@ -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

« previous php.cvs (#74396) next »