]> granicus.if.org Git - php/commitdiff
Clean up BreakIterator create_object handler
authorNikita Popov <nikita.ppv@gmail.com>
Fri, 14 Aug 2020 14:56:25 +0000 (16:56 +0200)
committerNikita Popov <nikita.ppv@gmail.com>
Tue, 25 Aug 2020 11:11:43 +0000 (13:11 +0200)
Use standard zend_object_alloc() function and fix the
object_init_properties() call (which works out okay because there
are no properties).

ext/intl/breakiterator/breakiterator_class.cpp

index 2114ada5588254ef00e15c1e6a9c7c643cc712b8..3f236db2d470ad6465d5d81a3a43883f19c0de33 100644 (file)
@@ -69,7 +69,7 @@ U_CFUNC void breakiterator_object_construct(zval *object,
        BreakIterator_object *bio;
 
        BREAKITER_METHOD_FETCH_OBJECT_NO_CHECK; //populate to from object
-       assert(bio->biter == NULL);
+       ZEND_ASSERT(bio->biter == NULL);
        bio->biter = biter;
 }
 
@@ -203,10 +203,10 @@ static zend_object *BreakIterator_object_create(zend_class_entry *ce)
 {
        BreakIterator_object*   intern;
 
-       intern = (BreakIterator_object*)ecalloc(1, sizeof(BreakIterator_object) + sizeof(zval) * (ce->default_properties_count - 1));
+       intern = (BreakIterator_object*) zend_object_alloc(sizeof(BreakIterator_object), ce);
 
        zend_object_std_init(&intern->zo, ce);
-    object_properties_init((zend_object*) intern, ce);
+       object_properties_init(&intern->zo, ce);
        breakiterator_object_init(intern);
 
        intern->zo.handlers = &BreakIterator_handlers;