From 4b4d634cb956de1efc13c8ed9b243fe1a85f783b Mon Sep 17 00:00:00 2001 From: "Yiduo (David) Wang" Date: Sun, 7 Oct 2007 05:22:07 +0000 Subject: MFH: Added macros for managing zval refcounts and is_ref statuses --- ext/mysqli/mysqli.c | 8 ++++---- ext/mysqli/mysqli_api.c | 4 ++-- 2 files changed, 6 insertions(+), 6 deletions(-) (limited to 'ext/mysqli') diff --git a/ext/mysqli/mysqli.c b/ext/mysqli/mysqli.c index 8de80f5e05..fcf946372d 100644 --- a/ext/mysqli/mysqli.c +++ b/ext/mysqli/mysqli.c @@ -352,7 +352,7 @@ zval *mysqli_read_property(zval *object, zval *member, int type TSRMLS_DC) ret = hnd->read_func(obj, &retval TSRMLS_CC); if (ret == SUCCESS) { /* ensure we're creating a temporary variable */ - retval->refcount = 0; + Z_SET_REFCOUNT_P(retval, 0); } else { retval = EG(uninitialized_zval_ptr); } @@ -392,8 +392,8 @@ void mysqli_write_property(zval *object, zval *member, zval *value TSRMLS_DC) } if (ret == SUCCESS) { hnd->write_func(obj, value TSRMLS_CC); - if (! PZVAL_IS_REF(value) && value->refcount == 0) { - value->refcount++; + if (! PZVAL_IS_REF(value) && Z_REFCOUNT_P(value) == 0) { + Z_ADDREF_P(value); zval_ptr_dtor(&value); } } else { @@ -1092,7 +1092,7 @@ void php_mysqli_fetch_into_hash(INTERNAL_FUNCTION_PARAMETERS, int override_flags } if (fetchtype & MYSQLI_ASSOC) { if (fetchtype & MYSQLI_NUM) { - ZVAL_ADDREF(res); + Z_ADDREF_P(res); } add_assoc_zval(return_value, fields[i].name, res); } diff --git a/ext/mysqli/mysqli_api.c b/ext/mysqli/mysqli_api.c index 5e55be7d51..e14c59268f 100644 --- a/ext/mysqli/mysqli_api.c +++ b/ext/mysqli/mysqli_api.c @@ -138,7 +138,7 @@ end_1: stmt->param.vars = (zval **)safe_emalloc(num_vars, sizeof(zval), 0); for (i = 0; i < num_vars; i++) { if (bind[i].buffer_type != MYSQL_TYPE_LONG_BLOB) { - ZVAL_ADDREF(*args[i+start]); + Z_ADDREF_PP(*args[i+start]); stmt->param.vars[i] = *args[i+start]; } else { stmt->param.vars[i] = NULL; @@ -426,7 +426,7 @@ mysqli_stmt_bind_result_do_bind(MY_STMT *stmt, zval ***args, unsigned int argc, stmt->result.vars = (zval **)safe_emalloc((var_cnt), sizeof(zval), 0); for (i = start; i < var_cnt+start; i++) { ofs = i-start; - ZVAL_ADDREF(*args[i]); + Z_ADDREF_PP(args[i]); stmt->result.vars[ofs] = *args[i]; } } -- cgit v1.2.1