summaryrefslogtreecommitdiff
path: root/ext/libxml
diff options
context:
space:
mode:
authorDmitry Stogov <dmitry@zend.com>2017-10-24 17:27:31 +0300
committerDmitry Stogov <dmitry@zend.com>2017-10-24 17:27:31 +0300
commit9cf87aa1965504b1cd9dc595a3c6af418a416cfc (patch)
tree887b57fe5485acc98b2ffb44149a1c049433a67c /ext/libxml
parent2ca08a3d66ea6fc6cca5337c5ade757bc86c1934 (diff)
downloadphp-git-9cf87aa1965504b1cd9dc595a3c6af418a416cfc.tar.gz
Avoid HashTable allocations for empty arrays (using zend_empty_array).
Diffstat (limited to 'ext/libxml')
-rw-r--r--ext/libxml/libxml.c5
1 files changed, 3 insertions, 2 deletions
diff --git a/ext/libxml/libxml.c b/ext/libxml/libxml.c
index c355ae2ba4..74a1736894 100644
--- a/ext/libxml/libxml.c
+++ b/ext/libxml/libxml.c
@@ -1042,10 +1042,9 @@ static PHP_FUNCTION(libxml_get_errors)
xmlErrorPtr error;
- array_init(return_value);
-
if (LIBXML(error_list)) {
+ array_init(return_value);
error = zend_llist_get_first(LIBXML(error_list));
while (error != NULL) {
@@ -1070,6 +1069,8 @@ static PHP_FUNCTION(libxml_get_errors)
error = zend_llist_get_next(LIBXML(error_list));
}
+ } else {
+ ZVAL_EMPTY_ARRAY(return_value);
}
}
/* }}} */