mirror of
https://github.com/php/php-src.git
synced 2026-03-24 00:02:20 +01:00
ext/curl: curl_getinfo, curl_multi_get_handles and curl_multi_setopt array optimisations. (#18389)
mainly change to packed arrays.
This commit is contained in:
@@ -2747,6 +2747,7 @@ PHP_FUNCTION(curl_getinfo)
|
||||
if (curl_easy_getinfo(ch->cp, option, &slist) == CURLE_OK) {
|
||||
struct curl_slist *current = slist;
|
||||
array_init(return_value);
|
||||
zend_hash_real_init_packed(Z_ARRVAL_P(return_value));
|
||||
while (current) {
|
||||
add_next_index_string(return_value, current->data);
|
||||
current = current->next;
|
||||
|
||||
@@ -185,7 +185,8 @@ PHP_FUNCTION(curl_multi_get_handles)
|
||||
|
||||
mh = Z_CURL_MULTI_P(z_mh);
|
||||
|
||||
array_init(return_value);
|
||||
array_init_size(return_value, zend_llist_count(&mh->easyh));
|
||||
zend_hash_real_init_packed(Z_ARRVAL_P(return_value));
|
||||
zend_llist_position pos;
|
||||
zval *pz_ch;
|
||||
|
||||
@@ -420,10 +421,11 @@ static int _php_server_push_callback(CURL *parent_ch, CURL *easy, size_t num_hea
|
||||
ch->cp = easy;
|
||||
_php_setup_easy_copy_handlers(ch, parent);
|
||||
|
||||
array_init(&headers);
|
||||
array_init_size(&headers, num_headers);
|
||||
zend_hash_real_init_packed(Z_ARRVAL(headers));
|
||||
for (size_t i = 0; i < num_headers; i++) {
|
||||
char *header = curl_pushheader_bynum(push_headers, i);
|
||||
add_next_index_string(&headers, header);
|
||||
add_index_string(&headers, i, header);
|
||||
}
|
||||
|
||||
ZEND_ASSERT(pz_parent_ch);
|
||||
|
||||
Reference in New Issue
Block a user