avoid repeated strlen usage

This commit is contained in:
Anatol Belski 2014-09-18 21:28:02 +02:00
parent 8a9dd4a1d7
commit 6beb91c202

View File

@ -553,6 +553,7 @@ PHP_METHOD(Phar, webPhar)
int entry_len, code, not_cgi;
phar_archive_data *phar = NULL;
phar_entry_info *info = NULL;
size_t sapi_mod_name_len = strlen(sapi_module.name);
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "|s!s!saz", &alias, &alias_len, &index_php, &index_php_len, &f404, &f404_len, &mimeoverride, &rewrite) == FAILURE) {
return;
@ -587,9 +588,9 @@ PHP_METHOD(Phar, webPhar)
++basename;
}
if ((strlen(sapi_module.name) == sizeof("cgi-fcgi")-1 && !strncmp(sapi_module.name, "cgi-fcgi", sizeof("cgi-fcgi")-1))
|| (strlen(sapi_module.name) == sizeof("fpm-fcgi")-1 && !strncmp(sapi_module.name, "fpm-fcgi", sizeof("fpm-fcgi")-1))
|| (strlen(sapi_module.name) == sizeof("cgi")-1 && !strncmp(sapi_module.name, "cgi", sizeof("cgi")-1))) {
if ((sapi_mod_name_len == sizeof("cgi-fcgi") - 1 && !strncmp(sapi_module.name, "cgi-fcgi", sizeof("cgi-fcgi") - 1))
|| (sapi_mod_name_len == sizeof("fpm-fcgi") - 1 && !strncmp(sapi_module.name, "fpm-fcgi", sizeof("fpm-fcgi") - 1))
|| (sapi_mod_name_len == sizeof("cgi") - 1 && !strncmp(sapi_module.name, "cgi", sizeof("cgi") - 1))) {
if (Z_TYPE(PG(http_globals)[TRACK_VARS_SERVER]) != IS_UNDEF) {
HashTable *_server = Z_ARRVAL(PG(http_globals)[TRACK_VARS_SERVER]);