summaryrefslogtreecommitdiff
path: root/ext/intl/dateformat/dateformat_class.c
diff options
context:
space:
mode:
Diffstat (limited to 'ext/intl/dateformat/dateformat_class.c')
-rw-r--r--ext/intl/dateformat/dateformat_class.c40
1 files changed, 17 insertions, 23 deletions
diff --git a/ext/intl/dateformat/dateformat_class.c b/ext/intl/dateformat/dateformat_class.c
index 211c87f59f..0d93338ecd 100644
--- a/ext/intl/dateformat/dateformat_class.c
+++ b/ext/intl/dateformat/dateformat_class.c
@@ -1,6 +1,6 @@
/*
+----------------------------------------------------------------------+
- | PHP Version 5 |
+ | PHP Version 7 |
+----------------------------------------------------------------------+
| This source file is subject to version 3.01 of the PHP license, |
| that is bundled with this package in the file LICENSE, and is |
@@ -35,16 +35,16 @@ static zend_object_handlers IntlDateFormatter_handlers;
*/
/* {{{ IntlDateFormatter_objects_dtor */
-static void IntlDateFormatter_object_dtor(void *object, zend_object_handle handle TSRMLS_DC )
+static void IntlDateFormatter_object_dtor(zend_object *object TSRMLS_DC )
{
- zend_objects_destroy_object( object, handle TSRMLS_CC );
+ zend_objects_destroy_object( object TSRMLS_CC );
}
/* }}} */
/* {{{ IntlDateFormatter_objects_free */
void IntlDateFormatter_object_free( zend_object *object TSRMLS_DC )
{
- IntlDateFormatter_object* dfo = (IntlDateFormatter_object*)object;
+ IntlDateFormatter_object* dfo = php_intl_dateformatter_fetch_object(object);
zend_object_std_dtor( &dfo->zo TSRMLS_CC );
@@ -53,18 +53,15 @@ void IntlDateFormatter_object_free( zend_object *object TSRMLS_DC )
}
dateformat_data_free( &dfo->datef_data TSRMLS_CC );
-
- efree( dfo );
}
/* }}} */
/* {{{ IntlDateFormatter_object_create */
-zend_object_value IntlDateFormatter_object_create(zend_class_entry *ce TSRMLS_DC)
+zend_object *IntlDateFormatter_object_create(zend_class_entry *ce TSRMLS_DC)
{
- zend_object_value retval;
IntlDateFormatter_object* intern;
- intern = ecalloc( 1, sizeof(IntlDateFormatter_object) );
+ intern = ecalloc( 1, sizeof(IntlDateFormatter_object) + sizeof(zval) * (ce->default_properties_count - 1) );
dateformat_data_init( &intern->datef_data TSRMLS_CC );
zend_object_std_init( &intern->zo, ce TSRMLS_CC );
object_properties_init(&intern->zo, ce);
@@ -73,31 +70,25 @@ zend_object_value IntlDateFormatter_object_create(zend_class_entry *ce TSRMLS_DC
intern->calendar = -1;
intern->requested_locale = NULL;
- retval.handle = zend_objects_store_put(
- intern,
- IntlDateFormatter_object_dtor,
- (zend_objects_free_object_storage_t)IntlDateFormatter_object_free,
- NULL TSRMLS_CC );
- retval.handlers = &IntlDateFormatter_handlers;
+ intern->zo.handlers = &IntlDateFormatter_handlers;
- return retval;
+ return &intern->zo;
}
/* }}} */
/* {{{ IntlDateFormatter_object_clone */
-zend_object_value IntlDateFormatter_object_clone(zval *object TSRMLS_DC)
+zend_object *IntlDateFormatter_object_clone(zval *object TSRMLS_DC)
{
- zend_object_value new_obj_val;
- zend_object_handle handle = Z_OBJ_HANDLE_P(object);
IntlDateFormatter_object *dfo, *new_dfo;
+ zend_object *new_obj;
DATE_FORMAT_METHOD_FETCH_OBJECT_NO_CHECK;
- new_obj_val = IntlDateFormatter_ce_ptr->create_object(Z_OBJCE_P(object) TSRMLS_CC);
- new_dfo = (IntlDateFormatter_object *)zend_object_store_get_object_by_handle(new_obj_val.handle TSRMLS_CC);
+ new_obj = IntlDateFormatter_ce_ptr->create_object(Z_OBJCE_P(object) TSRMLS_CC);
+ new_dfo = php_intl_dateformatter_fetch_object(new_obj);
/* clone standard parts */
- zend_objects_clone_members(&new_dfo->zo, new_obj_val, &dfo->zo, handle TSRMLS_CC);
+ zend_objects_clone_members(&new_dfo->zo, &dfo->zo TSRMLS_CC);
/* clone formatter object */
if (dfo->datef_data.udatf != NULL) {
DATE_FORMAT_OBJECT(new_dfo) = udat_clone(DATE_FORMAT_OBJECT(dfo), &INTL_DATA_ERROR_CODE(dfo));
@@ -110,7 +101,7 @@ zend_object_value IntlDateFormatter_object_clone(zval *object TSRMLS_DC)
} else {
zend_throw_exception(NULL, "Cannot clone unconstructed IntlDateFormatter", 0 TSRMLS_CC);
}
- return new_obj_val;
+ return new_obj;
}
/* }}} */
@@ -208,7 +199,10 @@ void dateformat_register_IntlDateFormatter_class( TSRMLS_D )
memcpy(&IntlDateFormatter_handlers, zend_get_std_object_handlers(),
sizeof IntlDateFormatter_handlers);
+ IntlDateFormatter_handlers.offset = XtOffsetOf(IntlDateFormatter_object, zo);
IntlDateFormatter_handlers.clone_obj = IntlDateFormatter_object_clone;
+ IntlDateFormatter_handlers.dtor_obj = IntlDateFormatter_object_dtor;
+ IntlDateFormatter_handlers.free_obj = IntlDateFormatter_object_free;
/* Declare 'IntlDateFormatter' class properties. */
if( !IntlDateFormatter_ce_ptr )