Hi Michael, As I understand the whole patch is OK for you.
This function make sense and I can add it then I'll commit the patch. I am not sure about refcount/reference magic and I haven't time to look into it right now. I'll check it before committing. Thanks. Dmitry. > -----Original Message----- > From: Michael Wallner [mailto:[EMAIL PROTECTED] > Sent: Tuesday, August 30, 2005 3:49 PM > To: internals@lists.php.net > Subject: Re: [PHP-DEV] Re: Constants and static methods for > internal classes > > > I wrote: > > > In case of zend_update_static_property(), because one would need to > > replicate the body of that function at each writing access? > > Please note that the code I'm currently using has changed > from the original patch: > > int zend_update_static_property(zend_class_entry *scope, char > *name, size_t name_len, zval *value TSRMLS_DC) { > int retval; > zval **property = NULL; > zend_class_entry *old_scope = EG(scope); > > EG(scope) = scope; > > if (!(property = zend_std_get_static_property(scope, > name, name_len, 0 TSRMLS_CC))) { > retval = FAILURE; > } else if (*property == value) { > retval = SUCCESS; > } else { > value->refcount++; > if (PZVAL_IS_REF(*property)) { > zval_dtor(*property); > (*property)->type = value->type; > (*property)->value = value->value; > > if (value->refcount) { > zval_copy_ctor(*property); > } > } else { > REPLACE_ZVAL_VALUE(property, value, 1); > } > retval = SUCCESS; > } > zval_ptr_dtor(&value); > EG(scope) = old_scope; > > return retval; > } > > Regards, > -- > Michael - < mike(@)php.net > > > -- > PHP Internals - PHP Runtime Development Mailing List > To unsubscribe, visit: http://www.php.net/unsub.php > > -- PHP Internals - PHP Runtime Development Mailing List To unsubscribe, visit: http://www.php.net/unsub.php