]> granicus.if.org Git - php/commitdiff
avoid unnecessary strlen calls in loop
authorAnatol Belski <ab@php.net>
Fri, 19 Sep 2014 10:36:23 +0000 (12:36 +0200)
committerAnatol Belski <ab@php.net>
Fri, 19 Sep 2014 10:36:23 +0000 (12:36 +0200)
ext/pcre/php_pcre.c
ext/phar/phar.c

index 89c5f1155bef65bab737bfcc15e0083023498344..0af6c5e3d7b5c25b90b74aef8286019f8c841000 100644 (file)
@@ -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);
                                        }
                                }
 
index 4c02e1aecf3cdcfbf07355b61da584c8e742a2b3..8f17c771d199f58a14c1e5dc8ebbab993eeabbcb 100644 (file)
@@ -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);