remove superfluous explicit deref

This commit is contained in:
CismonX 2019-06-08 00:07:11 +08:00
parent 2d99cda158
commit 533935f649
7 changed files with 34 additions and 56 deletions

View File

@ -15,7 +15,7 @@ namespace php_arma
{
zval *other;
ZEND_PARSE_PARAMETERS_START(1, 1)
Z_PARAM_OBJECT_DEREF(other)
Z_PARAM_OBJECT(other)
ZEND_PARSE_PARAMETERS_END();
operators::equals(getThis(), other, return_value);
@ -26,7 +26,7 @@ namespace php_arma
{
zval *other;
ZEND_PARSE_PARAMETERS_START(1, 1)
Z_PARAM_OBJECT_DEREF(other)
Z_PARAM_OBJECT(other)
ZEND_PARSE_PARAMETERS_END();
operators::not_equals(getThis(), other, return_value);
@ -37,7 +37,7 @@ namespace php_arma
{
zval *other;
ZEND_PARSE_PARAMETERS_START(1, 1)
Z_PARAM_OBJECT_DEREF(other)
Z_PARAM_OBJECT(other)
ZEND_PARSE_PARAMETERS_END();
operators::greater_than(getThis(), other, return_value);
@ -48,7 +48,7 @@ namespace php_arma
{
zval *other;
ZEND_PARSE_PARAMETERS_START(1, 1)
Z_PARAM_OBJECT_DEREF(other)
Z_PARAM_OBJECT(other)
ZEND_PARSE_PARAMETERS_END();
operators::smaller_than(getThis(), other, return_value);
@ -59,7 +59,7 @@ namespace php_arma
{
zval *other;
ZEND_PARSE_PARAMETERS_START(1, 1)
Z_PARAM_OBJECT_DEREF(other)
Z_PARAM_OBJECT(other)
ZEND_PARSE_PARAMETERS_END();
operators::not_greater_than(getThis(), other, return_value);
@ -70,7 +70,7 @@ namespace php_arma
{
zval *other;
ZEND_PARSE_PARAMETERS_START(1, 1)
Z_PARAM_OBJECT_DEREF(other)
Z_PARAM_OBJECT(other)
ZEND_PARSE_PARAMETERS_END();
operators::not_smaller_than(getThis(), other, return_value);

View File

@ -19,9 +19,9 @@ namespace php_arma
{
zend_long i, j;
ZEND_PARSE_PARAMETERS_START(1, 2)
Z_PARAM_LONG_DEREF(i)
Z_PARAM_LONG(i)
Z_PARAM_OPTIONAL
Z_PARAM_LONG_DEREF(j)
Z_PARAM_LONG(j)
ZEND_PARSE_PARAMETERS_END();
auto native = THIS_NATIVE;
@ -46,9 +46,9 @@ namespace php_arma
{
zend_long i, j;
ZEND_PARSE_PARAMETERS_START(1, 2)
Z_PARAM_LONG_DEREF(i)
Z_PARAM_LONG(i)
Z_PARAM_OPTIONAL
Z_PARAM_LONG_DEREF(j)
Z_PARAM_LONG(j)
ZEND_PARSE_PARAMETERS_END();
auto native = THIS_NATIVE;

View File

@ -19,7 +19,7 @@ namespace php_arma
double imag = 0.0;
ZEND_PARSE_PARAMETERS_START(0, 1)
Z_PARAM_OPTIONAL
Z_PARAM_DOUBLE_DEREF(imag)
Z_PARAM_DOUBLE(imag)
ZEND_PARSE_PARAMETERS_END();
zval_set_scalar(return_value, std::complex<double>(0.0, imag));

View File

@ -26,9 +26,9 @@ namespace php_arma
zend_long fill = fill::none;
ZEND_PARSE_PARAMETERS_START(0, 3)
Z_PARAM_OPTIONAL
Z_PARAM_LONG_DEREF(n_rows)
Z_PARAM_LONG_DEREF(n_cols)
Z_PARAM_LONG_DEREF(fill)
Z_PARAM_LONG(n_rows)
Z_PARAM_LONG(n_cols)
Z_PARAM_LONG(fill)
ZEND_PARSE_PARAMETERS_END();
auto zobj = create(n_rows, n_cols);
@ -41,7 +41,7 @@ namespace php_arma
{
zend_string *text;
ZEND_PARSE_PARAMETERS_START(1, 1)
Z_PARAM_STR_DEREF(text)
Z_PARAM_STR(text)
ZEND_PARSE_PARAMETERS_END();
auto zobj = create(ZSTR_VAL(text));
@ -53,7 +53,7 @@ namespace php_arma
{
zval *arr;
ZEND_PARSE_PARAMETERS_START(1, 1)
Z_PARAM_ARRAY_DEREF(arr)
Z_PARAM_ARRAY(arr)
ZEND_PARSE_PARAMETERS_END();
auto num_rows = zend_hash_num_elements(Z_ARR_P(arr));

View File

@ -71,28 +71,6 @@
static constexpr const char val[] = name; \
}
/// Helper macros for parameter parsing.
#if PHP_VERSION_ID >= 70200
#define Z_PARAM_DOUBLE_DEREF(dest) \
Z_PARAM_DOUBLE_EX2(dest, _dummy, 0, 1, 0)
#define Z_PARAM_LONG_DEREF(dest) \
Z_PARAM_LONG_EX2(dest, _dummy, 0, 1, 0)
#define Z_PARAM_STR_DEREF(dest) \
Z_PARAM_STR_EX2(dest, 0, 1, 0)
#define Z_PARAM_ARRAY_DEREF(dest) \
Z_PARAM_ARRAY_EX2(dest, 0, 1, 0)
#define Z_PARAM_OBJECT_DEREF(dest) \
Z_PARAM_OBJECT_EX2(dest, 0, 1, 0)
#else
// Before PHP 7.2, parameter is dereferenced by default here.
#define Z_PARAM_DOUBLE_DEREF Z_PARAM_DOUBLE
#define Z_PARAM_LONG_DEREF Z_PARAM_LONG
#define Z_PARAM_STR_DEREF Z_PARAM_STR
#define Z_PARAM_ARRAY_DEREF Z_PARAM_ARRAY
#define Z_PARAM_OBJECT_DEREF Z_PARAM_OBJECT
#endif
#ifdef PHP_ARMA_OPERATORS
/// Helper macros for handling operator overloading.

View File

@ -67,7 +67,7 @@ namespace php_arma
ZEND_PARSE_PARAMETERS_START(1, 2)
Z_PARAM_ZVAL_DEREF(dest)
Z_PARAM_OPTIONAL
Z_PARAM_LONG_DEREF(file_type)
Z_PARAM_LONG(file_type)
ZEND_PARSE_PARAMETERS_END();
auto native = THIS_NATIVE;
@ -110,7 +110,7 @@ namespace php_arma
ZEND_PARSE_PARAMETERS_START(1, 2)
Z_PARAM_ZVAL_DEREF(from)
Z_PARAM_OPTIONAL
Z_PARAM_LONG_DEREF(file_type)
Z_PARAM_LONG(file_type)
ZEND_PARSE_PARAMETERS_END();
auto native = THIS_NATIVE;

View File

@ -18,8 +18,8 @@ namespace php_arma
{
zend_long n_rows, n_cols;
ZEND_PARSE_PARAMETERS_START(2, 2)
Z_PARAM_LONG_DEREF(n_rows)
Z_PARAM_LONG_DEREF(n_cols)
Z_PARAM_LONG(n_rows)
Z_PARAM_LONG(n_cols)
ZEND_PARSE_PARAMETERS_END();
auto native = THIS_NATIVE;
@ -31,8 +31,8 @@ namespace php_arma
{
zend_long n_rows, n_cols;
ZEND_PARSE_PARAMETERS_START(2, 2)
Z_PARAM_LONG_DEREF(n_rows)
Z_PARAM_LONG_DEREF(n_cols)
Z_PARAM_LONG(n_rows)
Z_PARAM_LONG(n_cols)
ZEND_PARSE_PARAMETERS_END();
auto native = THIS_NATIVE;
@ -44,8 +44,8 @@ namespace php_arma
{
zend_long n_rows, n_cols;
ZEND_PARSE_PARAMETERS_START(2, 2)
Z_PARAM_LONG_DEREF(n_rows)
Z_PARAM_LONG_DEREF(n_cols)
Z_PARAM_LONG(n_rows)
Z_PARAM_LONG(n_cols)
ZEND_PARSE_PARAMETERS_END();
auto native = THIS_NATIVE;
@ -59,8 +59,8 @@ namespace php_arma
zend_long n_cols = 0;
ZEND_PARSE_PARAMETERS_START(0, 2)
Z_PARAM_OPTIONAL
Z_PARAM_LONG_DEREF(n_rows)
Z_PARAM_LONG_DEREF(n_cols)
Z_PARAM_LONG(n_rows)
Z_PARAM_LONG(n_cols)
ZEND_PARSE_PARAMETERS_END();
auto native = THIS_NATIVE;
@ -74,8 +74,8 @@ namespace php_arma
zend_long n_cols = 0;
ZEND_PARSE_PARAMETERS_START(0, 2)
Z_PARAM_OPTIONAL
Z_PARAM_LONG_DEREF(n_rows)
Z_PARAM_LONG_DEREF(n_cols)
Z_PARAM_LONG(n_rows)
Z_PARAM_LONG(n_cols)
ZEND_PARSE_PARAMETERS_END();
auto native = THIS_NATIVE;
@ -87,7 +87,7 @@ namespace php_arma
{
zend_long row_idx;
ZEND_PARSE_PARAMETERS_START(1, 1)
Z_PARAM_LONG_DEREF(row_idx)
Z_PARAM_LONG(row_idx)
ZEND_PARSE_PARAMETERS_END();
auto native = THIS_NATIVE;
@ -99,7 +99,7 @@ namespace php_arma
{
zend_long col_idx;
ZEND_PARSE_PARAMETERS_START(1, 1)
Z_PARAM_LONG_DEREF(col_idx)
Z_PARAM_LONG(col_idx)
ZEND_PARSE_PARAMETERS_END();
auto native = THIS_NATIVE;
@ -111,8 +111,8 @@ namespace php_arma
{
zend_long first_row, last_row;
ZEND_PARSE_PARAMETERS_START(2, 2)
Z_PARAM_LONG_DEREF(first_row)
Z_PARAM_LONG_DEREF(last_row)
Z_PARAM_LONG(first_row)
Z_PARAM_LONG(last_row)
ZEND_PARSE_PARAMETERS_END();
auto native = THIS_NATIVE;
@ -124,8 +124,8 @@ namespace php_arma
{
zend_long first_col, last_col;
ZEND_PARSE_PARAMETERS_START(2, 2)
Z_PARAM_LONG_DEREF(first_col)
Z_PARAM_LONG_DEREF(last_col)
Z_PARAM_LONG(first_col)
Z_PARAM_LONG(last_col)
ZEND_PARSE_PARAMETERS_END();
auto native = THIS_NATIVE;