summaryrefslogtreecommitdiff
path: root/ext/intl/formatter
diff options
context:
space:
mode:
authorNikita Popov <nikita.ppv@gmail.com>2017-11-25 16:07:51 +0100
committerNikita Popov <nikita.ppv@gmail.com>2017-11-25 17:12:37 +0100
commitb72b1a4e4d4a94a16b953bf8d826885efb56eeca (patch)
treed79e5390c77d3a5218f39262f2205280dacb8bf7 /ext/intl/formatter
parent8795893f4f90a344cc9a9d48523b7aa0ba5ebf05 (diff)
downloadphp-git-b72b1a4e4d4a94a16b953bf8d826885efb56eeca.tar.gz
Add zend_object_alloc() API
Using ecalloc() to create objects is expensive, because the dynamic-size memset() is unreasonably slow. Make sure we only zero the main object structure with known size, as the properties are intialized separately anyway. Technically we do not need to zero the embedded zend_object structure either, but as long as the memset argument is constant, a couple more bytes don't really matter.
Diffstat (limited to 'ext/intl/formatter')
-rw-r--r--ext/intl/formatter/formatter_class.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/ext/intl/formatter/formatter_class.c b/ext/intl/formatter/formatter_class.c
index ef54de9418..d15311201e 100644
--- a/ext/intl/formatter/formatter_class.c
+++ b/ext/intl/formatter/formatter_class.c
@@ -49,7 +49,7 @@ zend_object *NumberFormatter_object_create(zend_class_entry *ce)
{
NumberFormatter_object* intern;
- intern = ecalloc( 1, sizeof(NumberFormatter_object) + zend_object_properties_size(ce));
+ intern = zend_object_alloc(sizeof(NumberFormatter_object), ce);
formatter_data_init( &intern->nf_data );
zend_object_std_init( &intern->zo, ce );
object_properties_init(&intern->zo, ce);