From d146d15003442a2e5234dd2fab1605094dc21630 Mon Sep 17 00:00:00 2001 From: Dmitry Stogov Date: Fri, 20 Mar 2015 02:02:42 +0300 Subject: Optimize zend_string_realloc() add more specialized versions zend_string_extend() and zend_string_truncate() --- ext/pcre/php_pcre.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'ext/pcre/php_pcre.c') diff --git a/ext/pcre/php_pcre.c b/ext/pcre/php_pcre.c index 6e769e06f0..8080823b09 100644 --- a/ext/pcre/php_pcre.c +++ b/ext/pcre/php_pcre.c @@ -1158,7 +1158,7 @@ PHPAPI zend_string *php_pcre_replace_impl(pcre_cache_entry *pce, zend_string *su result = zend_string_alloc(alloc_len, 0); } else { alloc_len = alloc_len + 2 * new_len; - result = zend_string_realloc(result, alloc_len, 0); + result = zend_string_extend(result, alloc_len, 0); } } /* copy the part of the string before the match */ @@ -1779,7 +1779,7 @@ static PHP_FUNCTION(preg_quote) *q = '\0'; /* Reallocate string and return it */ - out_str = zend_string_realloc(out_str, q - out_str->val, 0); + out_str = zend_string_truncate(out_str, q - out_str->val, 0); RETURN_NEW_STR(out_str); } /* }}} */ -- cgit v1.2.1