mirror of
https://github.com/php/php-src.git
synced 2024-11-25 19:05:31 +08:00
Remove redundant callback, simplify API
This commit is contained in:
parent
05152d3845
commit
3f5acc73a5
@ -150,10 +150,9 @@ static inline zval **_get_zval_ptr_ptr(znode *node, temp_variable *Ts TSRMLS_DC)
|
||||
}
|
||||
}
|
||||
|
||||
static inline zval **zend_fetch_property_address_inner(zval *object, znode *op2, temp_variable *Ts, int type TSRMLS_DC)
|
||||
static inline void zend_fetch_property_address_inner(zval *object, znode *op2, znode *result, temp_variable *Ts, int type TSRMLS_DC)
|
||||
{
|
||||
zval *prop_ptr = get_zval_ptr(op2, Ts, &EG(free_op2), BP_VAR_R);
|
||||
zval **retval = NULL;
|
||||
zval tmp;
|
||||
|
||||
|
||||
@ -172,20 +171,20 @@ static inline zval **zend_fetch_property_address_inner(zval *object, znode *op2,
|
||||
break;
|
||||
}
|
||||
|
||||
if (Z_OBJ_HT_P(object)->get_property_ptr != NULL) {
|
||||
retval = Z_OBJ_HT_P(object)->get_property_ptr(object, prop_ptr TSRMLS_CC);
|
||||
}
|
||||
|
||||
if (retval == NULL) {
|
||||
if (Z_OBJ_HT_P(object)->get_property_ptr_ptr) {
|
||||
T(result->u.var).var.ptr_ptr = Z_OBJ_HT_P(object)->get_property_ptr_ptr(object, prop_ptr TSRMLS_CC);
|
||||
} else if (Z_OBJ_HT_P(object)->read_property) {
|
||||
T(result->u.var).var.ptr = Z_OBJ_HT_P(object)->read_property(object, prop_ptr, 0 TSRMLS_CC);
|
||||
T(result->u.var).var.ptr_ptr = &T(result->u.var).var.ptr;
|
||||
} else {
|
||||
zend_error(E_WARNING, "This object doesn't support property references");
|
||||
retval = &EG(error_zval_ptr);
|
||||
T(result->u.var).var.ptr_ptr = &EG(error_zval_ptr);
|
||||
}
|
||||
|
||||
if (prop_ptr == &tmp) {
|
||||
zval_dtor(prop_ptr);
|
||||
}
|
||||
FREE_OP(Ts, op2, EG(free_op2));
|
||||
return retval;
|
||||
}
|
||||
|
||||
|
||||
@ -1014,7 +1013,7 @@ static void zend_fetch_property_address(znode *result, znode *op1, znode *op2, t
|
||||
SEPARATE_ZVAL(container_ptr);
|
||||
container = *container_ptr;
|
||||
}
|
||||
*retval = zend_fetch_property_address_inner(container, op2, Ts, type TSRMLS_CC);
|
||||
zend_fetch_property_address_inner(container, op2, result, Ts, type TSRMLS_CC);
|
||||
SELECTIVE_PZVAL_LOCK(**retval, result);
|
||||
}
|
||||
|
||||
@ -1097,8 +1096,8 @@ static void zend_pre_incdec_property(znode *result, znode *op1, znode *op2, temp
|
||||
|
||||
/* here we are sure we are dealing with an object */
|
||||
|
||||
if (Z_OBJ_HT_P(object)->get_property_zval_ptr) {
|
||||
zval **zptr = Z_OBJ_HT_P(object)->get_property_zval_ptr(object, property TSRMLS_CC);
|
||||
if (Z_OBJ_HT_P(object)->get_property_ptr_ptr) {
|
||||
zval **zptr = Z_OBJ_HT_P(object)->get_property_ptr_ptr(object, property TSRMLS_CC);
|
||||
if (zptr != NULL) { /* NULL means no success in getting PTR */
|
||||
SEPARATE_ZVAL_IF_NOT_REF(zptr);
|
||||
|
||||
@ -1142,8 +1141,8 @@ static void zend_post_incdec_property(znode *result, znode *op1, znode *op2, tem
|
||||
|
||||
/* here we are sure we are dealing with an object */
|
||||
|
||||
if (Z_OBJ_HT_P(object)->get_property_zval_ptr) {
|
||||
zval **zptr = Z_OBJ_HT_P(object)->get_property_zval_ptr(object, property TSRMLS_CC);
|
||||
if (Z_OBJ_HT_P(object)->get_property_ptr_ptr) {
|
||||
zval **zptr = Z_OBJ_HT_P(object)->get_property_ptr_ptr(object, property TSRMLS_CC);
|
||||
if (zptr != NULL) { /* NULL means no success in getting PTR */
|
||||
have_get_ptr = 1;
|
||||
SEPARATE_ZVAL_IF_NOT_REF(zptr);
|
||||
@ -1534,8 +1533,8 @@ static inline int zend_binary_assign_op_obj_helper(int (*binary_op)(zval *result
|
||||
|
||||
/* here property is a string */
|
||||
if (EX(opline)->extended_value == ZEND_ASSIGN_OBJ
|
||||
&& Z_OBJ_HT_P(object)->get_property_zval_ptr) {
|
||||
zval **zptr = Z_OBJ_HT_P(object)->get_property_zval_ptr(object, property TSRMLS_CC);
|
||||
&& Z_OBJ_HT_P(object)->get_property_ptr_ptr) {
|
||||
zval **zptr = Z_OBJ_HT_P(object)->get_property_ptr_ptr(object, property TSRMLS_CC);
|
||||
if (zptr != NULL) { /* NULL means no success in getting PTR */
|
||||
SEPARATE_ZVAL_IF_NOT_REF(zptr);
|
||||
|
||||
|
@ -386,7 +386,7 @@ static void zend_std_write_dimension(zval *object, zval *offset, zval *value TSR
|
||||
}
|
||||
|
||||
|
||||
static zval **zend_std_get_property_ptr(zval *object, zval *member TSRMLS_DC)
|
||||
static zval **zend_std_get_property_ptr_ptr(zval *object, zval *member TSRMLS_DC)
|
||||
{
|
||||
zend_object *zobj;
|
||||
zval tmp_member;
|
||||
@ -429,6 +429,15 @@ static zval **zend_std_get_property_ptr(zval *object, zval *member TSRMLS_DC)
|
||||
return retval;
|
||||
}
|
||||
|
||||
|
||||
static zval *zend_std_get_property_ptr(zval *object, zval *member TSRMLS_DC)
|
||||
{
|
||||
zval **rv = zend_std_get_property_ptr_ptr(object, member TSRMLS_CC);
|
||||
|
||||
return *rv;
|
||||
}
|
||||
|
||||
|
||||
static void zend_std_unset_property(zval *object, zval *member TSRMLS_DC)
|
||||
{
|
||||
zend_object *zobj;
|
||||
@ -892,8 +901,7 @@ zend_object_handlers std_object_handlers = {
|
||||
zend_std_write_property, /* write_property */
|
||||
zend_std_read_dimension, /* read_dimension */
|
||||
zend_std_write_dimension, /* write_dimension */
|
||||
zend_std_get_property_ptr, /* get_property_ptr */
|
||||
zend_std_get_property_ptr, /* get_property_zval_ptr */
|
||||
zend_std_get_property_ptr_ptr, /* get_property_ptr_ptr */
|
||||
NULL, /* get */
|
||||
NULL, /* set */
|
||||
zend_std_has_property, /* has_property */
|
||||
|
@ -36,11 +36,8 @@ typedef void (*zend_object_write_property_t)(zval *object, zval *member, zval *v
|
||||
/* Used to set dimension of the object */
|
||||
typedef void (*zend_object_write_dimension_t)(zval *object, zval *offset, zval *value TSRMLS_DC);
|
||||
|
||||
/* Used to create pointer to the property of the object, for future r/w access via get/set */
|
||||
typedef zval **(*zend_object_get_property_ptr_t)(zval *object, zval *member TSRMLS_DC);
|
||||
|
||||
/* Used to create pointer to the property of the object, for future direct r/w access */
|
||||
typedef zval **(*zend_object_get_property_zval_ptr_t)(zval *object, zval *member TSRMLS_DC);
|
||||
typedef zval **(*zend_object_get_property_ptr_ptr_t)(zval *object, zval *member TSRMLS_DC);
|
||||
|
||||
/* Used to set object value (most probably used in combination with
|
||||
* typedef the result of the get_property_ptr)
|
||||
@ -96,8 +93,7 @@ typedef struct _zend_object_handlers {
|
||||
zend_object_write_property_t write_property;
|
||||
zend_object_read_dimension_t read_dimension;
|
||||
zend_object_write_dimension_t write_dimension;
|
||||
zend_object_get_property_ptr_t get_property_ptr;
|
||||
zend_object_get_property_zval_ptr_t get_property_zval_ptr;
|
||||
zend_object_get_property_ptr_ptr_t get_property_ptr_ptr;
|
||||
zend_object_get_t get;
|
||||
zend_object_set_t set;
|
||||
zend_object_has_property_t has_property;
|
||||
|
@ -275,8 +275,7 @@ static zend_object_handlers zend_object_proxy_handlers = {
|
||||
NULL, /* write_property */
|
||||
NULL, /* read dimension */
|
||||
NULL, /* write_dimension */
|
||||
NULL, /* get_property_ptr */
|
||||
NULL, /* get_property_zval_ptr */
|
||||
NULL, /* get_property_ptr_ptr */
|
||||
zend_object_proxy_get, /* get */
|
||||
zend_object_proxy_set, /* set */
|
||||
NULL, /* has_property */
|
||||
|
Loading…
Reference in New Issue
Block a user