From 3da415662a3dd1fa339e208ae87c3a6b95edce89 Mon Sep 17 00:00:00 2001 From: Niels Dossche <7771979+nielsdos@users.noreply.github.com> Date: Sun, 4 Jun 2023 15:20:04 +0200 Subject: [PATCH] Switch DOMNodeList::item() and DOMNamedNodeMap::item() to fast ZPP (#11361) Code size impact: * DOMNodeList::item() => +96 bytes hot, +31 bytes cold * DOMNamedNodeMap::item() => +57 bytes hot, +31 bytes cold --- ext/dom/namednodemap.c | 6 +++--- ext/dom/nodelist.c | 6 +++--- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/ext/dom/namednodemap.c b/ext/dom/namednodemap.c index 99103ce30b7..dadab115a1c 100644 --- a/ext/dom/namednodemap.c +++ b/ext/dom/namednodemap.c @@ -142,9 +142,9 @@ PHP_METHOD(DOMNamedNodeMap, item) int count; id = ZEND_THIS; - if (zend_parse_parameters(ZEND_NUM_ARGS(), "l", &index) == FAILURE) { - RETURN_THROWS(); - } + ZEND_PARSE_PARAMETERS_START(1, 1) + Z_PARAM_LONG(index) + ZEND_PARSE_PARAMETERS_END(); if (index < 0 || ZEND_LONG_INT_OVFL(index)) { zend_argument_value_error(1, "must be between 0 and %d", INT_MAX); RETURN_THROWS(); diff --git a/ext/dom/nodelist.c b/ext/dom/nodelist.c index 20e3b18bee8..55073b25501 100644 --- a/ext/dom/nodelist.c +++ b/ext/dom/nodelist.c @@ -154,9 +154,9 @@ PHP_METHOD(DOMNodeList, item) int count = 0; id = ZEND_THIS; - if (zend_parse_parameters(ZEND_NUM_ARGS(), "l", &index) == FAILURE) { - RETURN_THROWS(); - } + ZEND_PARSE_PARAMETERS_START(1, 1) + Z_PARAM_LONG(index) + ZEND_PARSE_PARAMETERS_END(); if (index >= 0) { intern = Z_DOMOBJ_P(id);