Skip to content

Commit 09b5a5a

Browse files
committed
ext/spl: convert ArrayObject/ArrayIterator to fast ZPP
So we no longer rely on the A ZPP specifier that I'm investigating
1 parent 425cd3d commit 09b5a5a

1 file changed

Lines changed: 14 additions & 9 deletions

File tree

ext/spl/spl_array.c

Lines changed: 14 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -996,9 +996,12 @@ PHP_METHOD(ArrayObject, __construct)
996996
return; /* nothing to do */
997997
}
998998

999-
if (zend_parse_parameters(ZEND_NUM_ARGS(), "|AlC", &array, &ar_flags, &ce_get_iterator) == FAILURE) {
1000-
RETURN_THROWS();
1001-
}
999+
ZEND_PARSE_PARAMETERS_START(0, 3)
1000+
Z_PARAM_OPTIONAL
1001+
Z_PARAM_ARRAY_OR_OBJECT(array)
1002+
Z_PARAM_LONG(ar_flags)
1003+
Z_PARAM_CLASS(ce_get_iterator)
1004+
ZEND_PARSE_PARAMETERS_END();
10021005

10031006
intern = Z_SPLARRAY_P(object);
10041007

@@ -1073,9 +1076,9 @@ PHP_METHOD(ArrayObject, exchangeArray)
10731076
zval *object = ZEND_THIS, *array;
10741077
spl_array_object *intern = Z_SPLARRAY_P(object);
10751078

1076-
if (zend_parse_parameters(ZEND_NUM_ARGS(), "A", &array) == FAILURE) {
1077-
RETURN_THROWS();
1078-
}
1079+
ZEND_PARSE_PARAMETERS_START(1, 1)
1080+
Z_PARAM_ARRAY_OR_OBJECT(array)
1081+
ZEND_PARSE_PARAMETERS_END();
10791082

10801083
if (intern->nApplyCount > 0) {
10811084
zend_throw_error(NULL, "Modification of ArrayObject during sorting is prohibited");
@@ -1654,9 +1657,11 @@ PHP_METHOD(ArrayIterator, __construct)
16541657
return; /* nothing to do */
16551658
}
16561659

1657-
if (zend_parse_parameters(ZEND_NUM_ARGS(), "|Al", &array, &ar_flags) == FAILURE) {
1658-
RETURN_THROWS();
1659-
}
1660+
ZEND_PARSE_PARAMETERS_START(0, 2)
1661+
Z_PARAM_OPTIONAL
1662+
Z_PARAM_ARRAY_OR_OBJECT(array)
1663+
Z_PARAM_LONG(ar_flags)
1664+
ZEND_PARSE_PARAMETERS_END();
16601665

16611666
intern = Z_SPLARRAY_P(object);
16621667

0 commit comments

Comments
 (0)