com php-src: avoid unnecessary strlen calls in loop: ext/pcre/php_pcre.c ext/phar/phar.c

From: Date: Fri, 19 Sep 2014 10:36:23 +0000
Subject: com php-src: avoid unnecessary strlen calls in loop: ext/pcre/php_pcre.c ext/phar/phar.c
Groups: php.cvs 
Request: Send a blank email to php-cvs+get-81755@lists.php.net to get a copy of this message
Commit: d8de53d498cf75936c9cd6781456c39b01f5af60 Author: Anatol Belski <ab@php.net> Fri, 19 Sep 2014 12:36:23 +0200 Parents: babcad063f3042d5fb374b5013c5c742407c1bd2 Branches: master Link: http://git.php.net/?p=php-src.git;a=commitdiff;h=d8de53d498cf75936c9cd6781456c39b01f5af60 Log: avoid unnecessary strlen calls in loop Changed paths: M ext/pcre/php_pcre.c M ext/phar/phar.c Diff: diff --git a/ext/pcre/php_pcre.c b/ext/pcre/php_pcre.c index 89c5f11..0af6c5e 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 4c02e1a..8f17c77 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);

« previous php.cvs (#81755) next »