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/reflection/php_reflection.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'ext/reflection/php_reflection.c') diff --git a/ext/reflection/php_reflection.c b/ext/reflection/php_reflection.c index bed3823a4e..72a88be47c 100644 --- a/ext/reflection/php_reflection.c +++ b/ext/reflection/php_reflection.c @@ -140,7 +140,7 @@ static string *string_printf(string *str, const char *format, ...) if (str->alloced < nlen) { size_t old_len = str->buf->len; str->alloced = nlen; - str->buf = zend_string_realloc(str->buf, str->alloced, 0); + str->buf = zend_string_extend(str->buf, str->alloced, 0); str->buf->len = old_len; } memcpy(str->buf->val + str->buf->len, s_tmp, len + 1); @@ -157,7 +157,7 @@ static string *string_write(string *str, char *buf, size_t len) if (str->alloced < nlen) { size_t old_len = str->buf->len; str->alloced = nlen; - str->buf = zend_string_realloc(str->buf, str->alloced, 0); + str->buf = zend_string_extend(str->buf, str->alloced, 0); str->buf->len = old_len; } memcpy(str->buf->val + str->buf->len, buf, len); -- cgit v1.2.1