diff options
Diffstat (limited to 'ext/curl/multi.c')
-rw-r--r-- | ext/curl/multi.c | 32 |
1 files changed, 13 insertions, 19 deletions
diff --git a/ext/curl/multi.c b/ext/curl/multi.c index 772b53ecc9..ba07ebdd5c 100644 --- a/ext/curl/multi.c +++ b/ext/curl/multi.c @@ -67,7 +67,6 @@ PHP_FUNCTION(curl_multi_init) object_init_ex(return_value, curl_multi_ce); mh = Z_CURL_MULTI_P(return_value); mh->multi = curl_multi_init(); - mh->handlers = ecalloc(1, sizeof(php_curlm_handlers)); zend_llist_init(&mh->easyh, sizeof(zval), _php_curl_multi_cleanup_list, 0); } @@ -370,7 +369,7 @@ static int _php_server_push_callback(CURL *parent_ch, CURL *easy, size_t num_hea php_curl *parent; php_curlm *mh = (php_curlm *)userp; size_t rval = CURL_PUSH_DENY; - php_curl_callback *t = mh->handlers->server_push; + php_curl_callback *t = mh->handlers.server_push; zval *pz_parent_ch = NULL; zval pz_ch; zval headers; @@ -459,15 +458,15 @@ static int _php_curl_multi_setopt(php_curlm *mh, zend_long option, zval *zvalue, } #if LIBCURL_VERSION_NUM > 0x072D00 /* Available since 7.45.0 */ case CURLMOPT_PUSHFUNCTION: - if (mh->handlers->server_push == NULL) { - mh->handlers->server_push = ecalloc(1, sizeof(php_curl_callback)); - } else if (!Z_ISUNDEF(mh->handlers->server_push->func_name)) { - zval_ptr_dtor(&mh->handlers->server_push->func_name); - mh->handlers->server_push->fci_cache = empty_fcall_info_cache; + if (mh->handlers.server_push == NULL) { + mh->handlers.server_push = ecalloc(1, sizeof(php_curl_callback)); + } else if (!Z_ISUNDEF(mh->handlers.server_push->func_name)) { + zval_ptr_dtor(&mh->handlers.server_push->func_name); + mh->handlers.server_push->fci_cache = empty_fcall_info_cache; } - ZVAL_COPY(&mh->handlers->server_push->func_name, zvalue); - mh->handlers->server_push->method = PHP_CURL_USER; + ZVAL_COPY(&mh->handlers.server_push->func_name, zvalue); + mh->handlers.server_push->method = PHP_CURL_USER; error = curl_multi_setopt(mh->multi, option, _php_server_push_callback); if (error != CURLM_OK) { return 0; @@ -553,12 +552,9 @@ void curl_multi_free_obj(zend_object *object) curl_multi_cleanup(mh->multi); zend_llist_clean(&mh->easyh); - if (mh->handlers->server_push) { - zval_ptr_dtor(&mh->handlers->server_push->func_name); - efree(mh->handlers->server_push); - } - if (mh->handlers) { - efree(mh->handlers); + if (mh->handlers.server_push) { + zval_ptr_dtor(&mh->handlers.server_push->func_name); + efree(mh->handlers.server_push); } zend_object_std_dtor(&mh->std); @@ -570,10 +566,8 @@ static HashTable *curl_multi_get_gc(zend_object *object, zval **table, int *n) zend_get_gc_buffer *gc_buffer = zend_get_gc_buffer_create(); - if (curl_multi->handlers) { - if (curl_multi->handlers->server_push) { - zend_get_gc_buffer_add_zval(gc_buffer, &curl_multi->handlers->server_push->func_name); - } + if (curl_multi->handlers.server_push) { + zend_get_gc_buffer_add_zval(gc_buffer, &curl_multi->handlers.server_push->func_name); } zend_llist_position pos; |