diff options
author | Anatol Belski <ab@php.net> | 2017-12-19 13:12:20 +0100 |
---|---|---|
committer | Anatol Belski <ab@php.net> | 2017-12-19 15:42:34 +0100 |
commit | fc46c4b1061f54246a754dd7a32a41902062e652 (patch) | |
tree | 5c1b225abe7e4f1d318a0d8277a3706eb85cd61a /ext | |
parent | 50e8ee128f2ed9dc476bb4dc240b99a883320784 (diff) | |
download | php-git-fc46c4b1061f54246a754dd7a32a41902062e652.tar.gz |
Avoid strlen call
Diffstat (limited to 'ext')
-rw-r--r-- | ext/opcache/ZendAccelerator.c | 2 | ||||
-rw-r--r-- | ext/opcache/zend_accelerator_blacklist.c | 4 | ||||
-rw-r--r-- | ext/opcache/zend_accelerator_blacklist.h | 2 |
3 files changed, 4 insertions, 4 deletions
diff --git a/ext/opcache/ZendAccelerator.c b/ext/opcache/ZendAccelerator.c index be15192148..1b1fbf9fcf 100644 --- a/ext/opcache/ZendAccelerator.c +++ b/ext/opcache/ZendAccelerator.c @@ -1621,7 +1621,7 @@ static zend_persistent_script *opcache_compile_file(zend_file_handle *file_handl } /* check blacklist right after ensuring that file was opened */ - if (file_handle->opened_path && zend_accel_blacklist_is_blacklisted(&accel_blacklist, ZSTR_VAL(file_handle->opened_path))) { + if (file_handle->opened_path && zend_accel_blacklist_is_blacklisted(&accel_blacklist, ZSTR_VAL(file_handle->opened_path), ZSTR_LEN(file_handle->opened_path))) { ZCSG(blacklist_misses)++; *op_array_p = accelerator_orig_compile_file(file_handle, type); return NULL; diff --git a/ext/opcache/zend_accelerator_blacklist.c b/ext/opcache/zend_accelerator_blacklist.c index 8b8c9b0d37..6d3a10e2b1 100644 --- a/ext/opcache/zend_accelerator_blacklist.c +++ b/ext/opcache/zend_accelerator_blacklist.c @@ -343,7 +343,7 @@ void zend_accel_blacklist_load(zend_blacklist *blacklist, char *filename) } #endif -zend_bool zend_accel_blacklist_is_blacklisted(zend_blacklist *blacklist, char *verify_path) +zend_bool zend_accel_blacklist_is_blacklisted(zend_blacklist *blacklist, char *verify_path, size_t verify_path_len) { int ret = 0; zend_regexp_list *regexp_list_it = blacklist->regexp_list; @@ -358,7 +358,7 @@ zend_bool zend_accel_blacklist_is_blacklisted(zend_blacklist *blacklist, char *v /* Alloc failed, but next one could still come through and match. */ continue; } - int rc = pcre2_match(regexp_list_it->re, (PCRE2_SPTR)verify_path, strlen(verify_path), 0, 0, match_data, mctx); + int rc = pcre2_match(regexp_list_it->re, (PCRE2_SPTR)verify_path, verify_path_len, 0, 0, match_data, mctx); if (rc >= 0) { ret = 1; php_pcre_free_match_data(match_data); diff --git a/ext/opcache/zend_accelerator_blacklist.h b/ext/opcache/zend_accelerator_blacklist.h index 863f9ed165..958f4a72ff 100644 --- a/ext/opcache/zend_accelerator_blacklist.h +++ b/ext/opcache/zend_accelerator_blacklist.h @@ -45,7 +45,7 @@ void zend_accel_blacklist_init(zend_blacklist *blacklist); void zend_accel_blacklist_shutdown(zend_blacklist *blacklist); void zend_accel_blacklist_load(zend_blacklist *blacklist, char *filename); -zend_bool zend_accel_blacklist_is_blacklisted(zend_blacklist *blacklist, char *verify_path); +zend_bool zend_accel_blacklist_is_blacklisted(zend_blacklist *blacklist, char *verify_path, size_t verify_path_len); void zend_accel_blacklist_apply(zend_blacklist *blacklist, blacklist_apply_func_arg_t func, void *argument); #endif /* ZEND_ACCELERATOR_BLACKLIST_H */ |