From: Anatol Belski Date: Fri, 19 Sep 2014 10:36:23 +0000 (+0200) Subject: avoid unnecessary strlen calls in loop X-Git-Tag: POST_NATIVE_TLS_MERGE^2~192 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=d8de53d498cf75936c9cd6781456c39b01f5af60;p=php avoid unnecessary strlen calls in loop --- diff --git a/ext/pcre/php_pcre.c b/ext/pcre/php_pcre.c index 89c5f1155b..0af6c5e3d7 100644 --- a/ext/pcre/php_pcre.c +++ b/ext/pcre/php_pcre.c @@ -782,7 +782,7 @@ PHPAPI void php_pcre_match_impl(pcre_cache_entry *pce, char *subject, int subjec } /* Add MARK, if available */ if (mark) { - add_assoc_string(&result_set, "MARK", (char *) mark); + add_assoc_string_ex(&result_set, "MARK", sizeof("MARK") - 1, (char *)mark); } /* And add it to the output array */ zend_hash_next_index_insert(Z_ARRVAL_P(subpats), &result_set); @@ -822,7 +822,7 @@ PHPAPI void php_pcre_match_impl(pcre_cache_entry *pce, char *subject, int subjec } /* Add MARK, if available */ if (mark) { - add_assoc_string(subpats, "MARK", (char *) mark); + add_assoc_string_ex(subpats, "MARK", sizeof("MARK") - 1, (char *)mark); } } diff --git a/ext/phar/phar.c b/ext/phar/phar.c index 4c02e1aecf..8f17c771d1 100644 --- a/ext/phar/phar.c +++ b/ext/phar/phar.c @@ -1618,7 +1618,7 @@ static int phar_open_from_fp(php_stream* fp, char *fname, int fname_len, char *a #ifndef MAX_WBITS #define MAX_WBITS 15 #endif - add_assoc_long(&filterparams, "window", MAX_WBITS + 32); + add_assoc_long_ex(&filterparams, "window", sizeof("window") - 1, MAX_WBITS + 32); /* entire file is gzip-compressed, uncompress to temporary file */ if (!(temp = php_stream_fopen_tmpfile())) { @@ -1630,7 +1630,7 @@ static int phar_open_from_fp(php_stream* fp, char *fname, int fname_len, char *a if (!filter) { err = 1; - add_assoc_long(&filterparams, "window", MAX_WBITS); + add_assoc_long_ex(&filterparams, "window", sizeof("window") - 1, MAX_WBITS); filter = php_stream_filter_create("zlib.inflate", &filterparams, php_stream_is_persistent(fp) TSRMLS_CC); zval_dtor(&filterparams);