8000 ext/curl: Refactor cURL to only use FCC by Girgias · Pull Request #13291 · php/php-src · GitHub
[go: up one dir, main page]

Skip to content

ext/curl: Refactor cURL to only use FCC #13291

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 15 commits into from
May 1, 2024
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Remove unnecessary set to NULL/empty FCC
  • Loading branch information
Girgias committed Apr 30, 2024
commit 431d24a6be2ff26474687ca4e69f010d56d5a0b1
12 changes: 0 additions & 12 deletions ext/curl/interface.c
Original file line number Diff line number Diff line change
Expand Up @@ -1518,7 +1518,6 @@ static bool php_curl_set_callable_handler(zend_fcall_info_cache *const handler_f
{
if (ZEND_FCC_INITIALIZED(*handler_fcc)) {
zend_fcc_dtor(handler_fcc);
handler_fcc->function_handler = NULL;
}

char *error = NULL;
Expand Down Expand Up @@ -2699,15 +2698,12 @@ static void curl_free_obj(zend_object *object)
smart_str_free(&ch->handlers.write->buf);
if (ZEND_FCC_INITIALIZED(ch->handlers.write->fcc)) {
zend_fcc_dtor(&ch->handlers.write->fcc);
ch->handlers.write->fcc = empty_fcall_info_cache;
}
if (ZEND_FCC_INITIALIZED(ch->handlers.write_header->fcc)) {
zend_fcc_dtor(&ch->handlers.write_header->fcc);
ch->handlers.write_header->fcc = empty_fcall_info_cache;
}
if (ZEND_FCC_INITIALIZED(ch->handlers.read->fcc)) {
zend_fcc_dtor(&ch->handlers.read->fcc);
ch->handlers.read->fcc = empty_fcall_info_cache;
}
zval_ptr_dtor(&ch->handlers.std_err);
if (ch->header.str) {
Expand All @@ -2724,20 +2720,16 @@ static void curl_free_obj(zend_object *object)

if (ZEND_FCC_INITIALIZED(ch->handlers.progress)) {
zend_fcc_dtor(&ch->handlers.progress);
ch->handlers.progress = empty_fcall_info_cache;
}
if (ZEND_FCC_INITIALIZED(ch->handlers.xferinfo)) {
zend_fcc_dtor(&ch->handlers.xferinfo);
ch->handlers.xferinfo = empty_fcall_info_cache;
}
if (ZEND_FCC_INITIALIZED(ch->handlers.fnmatch)) {
zend_fcc_dtor(&ch->handlers.fnmatch);
ch->handlers.fnmatch = empty_fcall_info_cache;
}
#if LIBCURL_VERSION_NUM >= 0x075400 /* Available since 7.84.0 */
if (ZEND_FCC_INITIALIZED(ch->handlers.sshhostkey)) {
zend_fcc_dtor(&ch->handlers.sshhostkey);
ch->handlers.sshhostkey = empty_fcall_info_cache;
}
#endif

Expand Down Expand Up @@ -2804,23 +2796,19 @@ static void _php_curl_reset_handlers(php_curl *ch)

if (ZEND_FCC_INITIALIZED(ch->handlers.progress)) {
zend_fcc_dtor(&ch->handlers.progress);
ch->handlers.progress = empty_fcall_info_cache;
}

if (ZEND_FCC_INITIALIZED(ch->handlers.xferinfo)) {
zend_fcc_dtor(&ch->handlers.xferinfo);
ch->handlers.xferinfo = empty_fcall_info_cache;
}

if (ZEND_FCC_INITIALIZED(ch->handlers.fnmatch)) {
zend_fcc_dtor(&ch->handlers.fnmatch);
ch->handlers.fnmatch = empty_fcall_info_cache;
}

#if LIBCURL_VERSION_NUM >= 0x075400 /* Available since 7.84.0 */
if (ZEND_FCC_INITIALIZED(ch->handlers.sshhostkey)) {
zend_fcc_dtor(&ch->handlers.sshhostkey);
ch->handlers.sshhostkey = empty_fcall_info_cache;
}
#endif
}
Expand Down
2 changes: 0 additions & 2 deletions ext/curl/multi.c
Original file line number Diff line number Diff line change
Expand Up @@ -446,7 +446,6 @@ static bool _php_curl_multi_setopt(php_curlm *mh, zend_long option, zval *zvalue
/* See php_curl_set_callable_handler */
if (ZEND_FCC_INITIALIZED(mh->handlers.server_push)) {
zend_fcc_dtor(&mh->handlers.server_push);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should this be set to the empty fcc?

mh->handlers.server_push = empty_fcall_info_cache;
}

char *error_str = NULL;
Expand Down Expand Up @@ -544,7 +543,6 @@ static void curl_multi_free_obj(zend_object *object)

if (ZEND_FCC_INITIALIZED(mh->handlers.server_push)) {
zend_fcc_dtor(&mh->handlers.server_push);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In other places you set it then to the empty fcc, did you forget to do that here?

mh->handlers.server_push = empty_fcall_info_cache;
}

zend_object_std_dtor(&mh->std);
Expand Down
0