Preallocate result array size in simplexml xpath

This is the simplexml version of 4dea42a.
This commit is contained in:
Niels Dossche 2023-09-09 22:59:24 +02:00
parent 0ea268b51a
commit d18bab5562

View file

@ -1309,7 +1309,8 @@ PHP_METHOD(SimpleXMLElement, xpath)
result = retval->nodesetval;
if (result != NULL) {
array_init(return_value);
array_init_size(return_value, result->nodeNr);
zend_hash_real_init_packed(Z_ARRVAL_P(return_value));
for (i = 0; i < result->nodeNr; ++i) {
nodeptr = result->nodeTab[i];