cvs: ZendEngine2 / zend_reflection_api.c
| From: | Marcus Boerger | Date: | Sun, 31 Aug 2003 10:06:13 +0000 |
| Subject: | cvs: ZendEngine2 / zend_reflection_api.c | ||
| Groups: | php.zend-engine.cvs | ||
| Request: | Send a blank email to php-zend-engine-cvs+get-1764@lists.php.net to get a copy of this message | ||
helly Sun Aug 31 06:06:13 2003 EDT
Modified files:
/ZendEngine2 zend_reflection_api.c
Log:
Using zend_spprintf should be faster here
Index: ZendEngine2/zend_reflection_api.c
diff -u ZendEngine2/zend_reflection_api.c:1.40 ZendEngine2/zend_reflection_api.c:1.41
--- ZendEngine2/zend_reflection_api.c:1.40 Sat Aug 30 19:51:42 2003
+++ ZendEngine2/zend_reflection_api.c Sun Aug 31 06:06:13 2003
@@ -18,7 +18,7 @@
+----------------------------------------------------------------------+
*/
-/* $Id: zend_reflection_api.c,v 1.40 2003/08/30 23:51:42 helly Exp $ */
+/* $Id: zend_reflection_api.c,v 1.41 2003/08/31 10:06:13 helly Exp $ */
#include "zend.h"
#include "zend_API.h"
#include "zend_default_classes.h"
@@ -80,17 +80,18 @@
{
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;
}