]> granicus.if.org Git - php/commitdiff
Eliminate another straight forward TSRMLS_FETCH() in zend_startup_module()
authorKalle Sommer Nielsen <kalle@php.net>
Thu, 12 Dec 2013 19:30:45 +0000 (20:30 +0100)
committerKalle Sommer Nielsen <kalle@php.net>
Thu, 12 Dec 2013 19:30:45 +0000 (20:30 +0100)
# 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

Zend/zend_API.c
Zend/zend_API.h
ext/opcache/ZendAccelerator.c
ext/opcache/ZendAccelerator.h
ext/opcache/zend_accelerator_module.c
ext/opcache/zend_accelerator_module.h
sapi/thttpd/thttpd.c

index 18f151e0ef582ebd4126907af25c3fa7576c929a..b3f59a71f1757cdc719e663dc1b1c0ffdda42c97 100644 (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;
        }
index 007d9896092beee18723ca36f88f88d3255359ef..c426acf497400dadb5e4c1d8b6fa06d0226567f2 100644 (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);
index 9398b58ac6b25689ecf0dda0d8452136c39a8f51..69a5d386d2707804dffdfa5ac100a1cd8fcb45fd 100644 (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;
index 487010ba27ad15620aac0dce500927dd621cf6b5..7ffd0126b321f181593083ba58b3abbad656bbaf 100644 (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
index cd840fd7dda96cf4d105c2e4d52ec23fab404893..1034e3e05d4eb4766b9e414aee1f4ad318417750 100644 (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 */
index 539b4e85af9c33406076b214e62f9c779e150b5b..74728f3f72557b517190a4c59c6a0b3daba2bdb7 100644 (file)
 #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 */
index 548bcda170abe19091cadf5932fef2694c74a27c..b136b71d7b2013eb0e6d7b6357201c2f26995c4e 100644 (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