diff options
Diffstat (limited to 'ext/intl/transliterator/transliterator_class.c')
-rw-r--r-- | ext/intl/transliterator/transliterator_class.c | 54 |
1 files changed, 10 insertions, 44 deletions
diff --git a/ext/intl/transliterator/transliterator_class.c b/ext/intl/transliterator/transliterator_class.c index e444f0eef4..0ca4fda755 100644 --- a/ext/intl/transliterator/transliterator_class.c +++ b/ext/intl/transliterator/transliterator_class.c @@ -189,19 +189,10 @@ err: /* {{{ get_property_ptr_ptr handler */ static zval *Transliterator_get_property_ptr_ptr( zend_object *object, zend_string *name, int type, void **cache_slot ) { - zval *retval; - - if(zend_binary_strcmp( "id", sizeof( "id" ) - 1, - ZSTR_VAL( name ), ZSTR_LEN( name ) ) == 0 ) - { - retval = NULL; /* fallback to read_property */ - } - else - { - retval = zend_std_get_property_ptr_ptr( object, name, type, cache_slot ); + if (zend_string_equals_literal(name, "id")) { + return NULL; /* fallback to read_property */ } - - return retval; + return zend_std_get_property_ptr_ptr( object, name, type, cache_slot ); } /* }}} */ @@ -210,15 +201,10 @@ static zval *Transliterator_read_property( zend_object *object, zend_string *nam { zval *retval; - if( ( type != BP_VAR_R && type != BP_VAR_IS ) && - ( zend_binary_strcmp( "id", sizeof( "id" ) - 1, - ZSTR_VAL( name ), ZSTR_LEN( name ) ) == 0 ) ) - { + if ((type != BP_VAR_R && type != BP_VAR_IS) && zend_string_equals_literal(name, "id")) { zend_throw_error(NULL, "Transliterator::$id is read-only"); retval = &EG( uninitialized_zval ); - } - else - { + } else { retval = zend_std_read_property( object, name, type, cache_slot, rv ); } @@ -238,14 +224,9 @@ static zval *Transliterator_write_property( zend_object *object, zend_string *na } else { scope = zend_get_executed_scope(); } - if( ( scope != Transliterator_ce_ptr ) && - ( zend_binary_strcmp( "id", sizeof( "id" ) - 1, - ZSTR_VAL( name ), ZSTR_LEN( name ) ) == 0 ) ) - { + if ((scope != Transliterator_ce_ptr) && zend_string_equals_literal(name, "id")) { zend_throw_error(NULL, "Transliterator::$id is read-only"); - } - else - { + } else { value = zend_std_write_property( object, name, value, cache_slot ); } @@ -258,14 +239,10 @@ static zval *Transliterator_write_property( zend_object *object, zend_string *na */ void transliterator_register_Transliterator_class( void ) { - zend_class_entry ce; - /* Create and register 'Transliterator' class. */ - INIT_CLASS_ENTRY( ce, "Transliterator", class_Transliterator_methods ); - ce.create_object = Transliterator_object_create; - Transliterator_ce_ptr = zend_register_internal_class( &ce ); - memcpy( &Transliterator_handlers, &std_object_handlers, - sizeof Transliterator_handlers ); + Transliterator_ce_ptr = register_class_Transliterator(); + Transliterator_ce_ptr->create_object = Transliterator_object_create; + memcpy( &Transliterator_handlers, &std_object_handlers, sizeof Transliterator_handlers ); Transliterator_handlers.offset = XtOffsetOf(Transliterator_object, zo); Transliterator_handlers.free_obj = Transliterator_objects_free; Transliterator_handlers.clone_obj = Transliterator_clone_obj; @@ -273,17 +250,6 @@ void transliterator_register_Transliterator_class( void ) Transliterator_handlers.read_property = Transliterator_read_property; Transliterator_handlers.write_property = Transliterator_write_property; - /* Declare 'Transliterator' class properties */ - if( !Transliterator_ce_ptr ) - { - zend_error( E_ERROR, - "Transliterator: attempt to create properties " - "on a non-registered class." ); - return; - } - zend_declare_property_null( Transliterator_ce_ptr, - "id", sizeof( "id" ) - 1, ZEND_ACC_PUBLIC ); - /* constants are declared in transliterator_register_constants, called from MINIT */ } |