com php-src: Avoid strlen call: ext/opcache/ZendAccelerator.c ext/opcache/zend_accelerator_blacklist.c ext/opcache/ze nd_accelerator_blacklist.h

From: Date: Tue, 19 Dec 2017 14:42:34 +0000
Subject: com php-src: Avoid strlen call: ext/opcache/ZendAccelerator.c ext/opcache/zend_accelerator_blacklist.c ext/opcache/ze nd_accelerator_blacklist.h
Groups: php.cvs 
Request: Send a blank email to php-cvs+get-100642@lists.php.net to get a copy of this message
Commit: fc46c4b1061f54246a754dd7a32a41902062e652 Author: Anatol Belski <ab@php.net> Tue, 19 Dec 2017 13:12:20 +0100 Parents: 50e8ee128f2ed9dc476bb4dc240b99a883320784 Branches: master Link: http://git.php.net/?p=php-src.git;a=commitdiff;h=fc46c4b1061f54246a754dd7a32a41902062e652 Log: Avoid strlen call Changed paths: M ext/opcache/ZendAccelerator.c M ext/opcache/zend_accelerator_blacklist.c M ext/opcache/zend_accelerator_blacklist.h Diff: diff --git a/ext/opcache/ZendAccelerator.c b/ext/opcache/ZendAccelerator.c index be15192..1b1fbf9 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 8b8c9b0..6d3a10e 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 863f9ed..958f4a7 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 */

« previous php.cvs (#100642) next »