summaryrefslogtreecommitdiff
path: root/Zend/zend_reflection_api.c
diff options
context:
space:
mode:
authorMarcus Boerger <helly@php.net>2003-08-31 10:06:13 +0000
committerMarcus Boerger <helly@php.net>2003-08-31 10:06:13 +0000
commitade319ac54f08382963bf938e956b3b22ec185ea (patch)
tree7497babca709b991817ebf90ac9e3683d2430c77 /Zend/zend_reflection_api.c
parentd45fd8a1b102ed18dc417132df846f4c7cd80ae5 (diff)
downloadphp-git-ade319ac54f08382963bf938e956b3b22ec185ea.tar.gz
Using zend_spprintf should be faster here
Diffstat (limited to 'Zend/zend_reflection_api.c')
-rw-r--r--Zend/zend_reflection_api.c19
1 files changed, 10 insertions, 9 deletions
diff --git a/Zend/zend_reflection_api.c b/Zend/zend_reflection_api.c
index 4df1f9d438..21c8bf95f7 100644
--- a/Zend/zend_reflection_api.c
+++ b/Zend/zend_reflection_api.c
@@ -80,17 +80,18 @@ string *string_printf(string *str, const char *format, ...)
{
int n;
va_list arg;
- va_start(arg, format);
- n = vsnprintf(str->string + str->len - 1, str->alloced - str->len, format, arg);
- if (n > str->alloced - str->len) {
- while (n + str->len > str->alloced ) {
- str->alloced *= 2;
- }
- str->string = erealloc(str->string, str->alloced + 1);
- n = vsnprintf(str->string + str->len - 1, str->alloced - str->len, format, arg);
+ char *s_tmp;
+
+ va_start(arg, format);
+ n = zend_vspprintf(&s_tmp, 0, format, arg);
+ if (n) {
+ str->alloced += n;
+ str->string = erealloc(str->string, str->alloced);
+ memcpy(str->string + str->len - 1, s_tmp, n);
+ str->len += n;
}
+ efree(s_tmp);
va_end(arg);
- str->len += n;
return str;
}