Skip to content

Commit c0b5fd9

Browse files
committed
Address review comments
1 parent a44f218 commit c0b5fd9

File tree

2 files changed

+30
-23
lines changed

2 files changed

+30
-23
lines changed

ext/curl/interface.c

Lines changed: 29 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -592,7 +592,7 @@ static size_t curl_write(char *data, size_t size, size_t nmemb, void *ctx)
592592
ch->in_callback = false;
593593
if (!Z_ISUNDEF(retval)) {
594594
_php_curl_verify_handlers(ch, /* reporterror */ true);
595-
/* TODO Check callback returns an int or something castable to int */
595+
/* TODO Check callback returns an int or something castable to int */
596596
length = zval_get_long(&retval);
597597
}
598598

@@ -625,7 +625,7 @@ static int curl_fnmatch(void *ctx, const char *pattern, const char *string)
625625

626626
if (!Z_ISUNDEF(retval)) {
627627
_php_curl_verify_handlers(ch, /* reporterror */ true);
628-
/* TODO Check callback returns an int or something castable to int */
628+
/* TODO Check callback returns an int or something castable to int */
629629
rval = zval_get_long(&retval);
630630
}
631631
zval_ptr_dtor(&argv[0]);
@@ -661,12 +661,12 @@ static size_t curl_progress(void *clientp, double dltotal, double dlnow, double
661661
ch->in_callback = false;
662662

663663
if (!Z_ISUNDEF(retval)) {
664-
_php_curl_verify_handlers(ch, /* reporterror */ true);
665-
/* TODO Check callback returns an int or something castable to int */
666-
if (0 != zval_get_long(&retval)) {
667-
rval = 1;
668-
}
669-
}
664+
_php_curl_verify_handlers(ch, /* reporterror */ true);
665+
/* TODO Check callback returns an int or something castable to int */
666+
if (0 != zval_get_long(&retval)) {
667+
rval = 1;
668+
}
669+
}
670670

671671
zval_ptr_dtor(&args[0]);
672672
return rval;
@@ -699,12 +699,12 @@ static size_t curl_xferinfo(void *clientp, curl_off_t dltotal, curl_off_t dlnow,
699699
ch->in_callback = false;
700700

701701
if (!Z_ISUNDEF(retval)) {
702-
_php_curl_verify_handlers(ch, /* reporterror */ true);
703-
/* TODO Check callback returns an int or something castable to int */
704-
if (0 != zval_get_long(&retval)) {
705-
rval = 1;
706-
}
707-
}
702+
_php_curl_verify_handlers(ch, /* reporterror */ true);
703+
/* TODO Check callback returns an int or something castable to int */
704+
if (0 != zval_get_long(&retval)) {
705+
rval = 1;
706+
}
707+
}
708708

709709
zval_ptr_dtor(&argv[0]);
710710
return rval;
@@ -923,8 +923,8 @@ PHP_FUNCTION(curl_version)
923923
/* Add an array of features */
924924
{
925925
struct feat {
926-
const char *name;
927-
int bitmask;
926+
const char *name;
927+
int bitmask;
928928
};
929929

930930
unsigned int i;
@@ -974,7 +974,7 @@ PHP_FUNCTION(curl_version)
974974
#endif
975975
};
976976

977-
for(i = 0; i < sizeof(feats) / sizeof(feats[0]); i++) {
977+
for(i = 0; i < sizeof(feats) / sizeof(feats[0]); i++) {
978978
if (feats[i].name) {
979979
add_assoc_bool(&feature_list, feats[i].name, d->features & feats[i].bitmask ? true : false);
980980
}
@@ -1202,8 +1202,6 @@ void _php_setup_easy_copy_handlers(php_curl *ch, php_curl *source)
12021202
if (ZEND_FCC_INITIALIZED(source->handlers.write_header->fcc)) {
12031203
zend_fcc_dup(&source->handlers.write_header->fcc, &source->handlers.write_header->fcc);
12041204
}
1205-
php_curl_copy_fcc_with_option(ch, CURLOPT_XFERINFODATA, &ch->handlers.xferinfo, &source->handlers.xferinfo);
1206-
php_curl_copy_fcc_with_option(ch, CURLOPT_XFERINFODATA, &ch->handlers.xferinfo, &source->handlers.xferinfo);
12071205

12081206
curl_easy_setopt(ch->cp, CURLOPT_ERRORBUFFER, ch->err.str);
12091207
curl_easy_setopt(ch->cp, CURLOPT_FILE, (void *) ch);
@@ -2140,7 +2138,7 @@ static zend_result _php_curl_setopt(php_curl *ch, zend_long option, zval *zvalue
21402138
case CURLOPT_ISSUERCERT:
21412139
case CURLOPT_SSH_KNOWNHOSTS:
21422140
{
2143-
zend_string *tmp_str;
2141+
zend_string *tmp_str;
21442142
zend_string *str = zval_get_tmp_string(zvalue, &tmp_str);
21452143
zend_result ret;
21462144

@@ -2701,12 +2699,15 @@ static void curl_free_obj(zend_object *object)
27012699
smart_str_free(&ch->handlers.write->buf);
27022700
if (ZEND_FCC_INITIALIZED(ch->handlers.write->fcc)) {
27032701
zend_fcc_dtor(&ch->handlers.write->fcc);
2702+
ch->handlers.write->fcc = empty_fcall_info_cache;
27042703
}
27052704
if (ZEND_FCC_INITIALIZED(ch->handlers.write_header->fcc)) {
27062705
zend_fcc_dtor(&ch->handlers.write_header->fcc);
2706+
ch->handlers.write_header->fcc = empty_fcall_info_cache;
27072707
}
27082708
if (ZEND_FCC_INITIALIZED(ch->handlers.read->fcc)) {
27092709
zend_fcc_dtor(&ch->handlers.read->fcc);
2710+
ch->handlers.read->fcc = empty_fcall_info_cache;
27102711
}
27112712
zval_ptr_dtor(&ch->handlers.std_err);
27122713
if (ch->header.str) {
@@ -2723,16 +2724,20 @@ static void curl_free_obj(zend_object *object)
27232724

27242725
if (ZEND_FCC_INITIALIZED(ch->handlers.progress)) {
27252726
zend_fcc_dtor(&ch->handlers.progress);
2727+
ch->handlers.progress = empty_fcall_info_cache;
27262728
}
27272729
if (ZEND_FCC_INITIALIZED(ch->handlers.xferinfo)) {
27282730
zend_fcc_dtor(&ch->handlers.xferinfo);
2731+
ch->handlers.xferinfo = empty_fcall_info_cache;
27292732
}
27302733
if (ZEND_FCC_INITIALIZED(ch->handlers.fnmatch)) {
27312734
zend_fcc_dtor(&ch->handlers.fnmatch);
2735+
ch->handlers.fnmatch = empty_fcall_info_cache;
27322736
}
27332737
#if LIBCURL_VERSION_NUM >= 0x075400 /* Available since 7.84.0 */
27342738
if (ZEND_FCC_INITIALIZED(ch->handlers.sshhostkey)) {
27352739
zend_fcc_dtor(&ch->handlers.sshhostkey);
2740+
ch->handlers.sshhostkey = empty_fcall_info_cache;
27362741
}
27372742
#endif
27382743

@@ -2799,20 +2804,23 @@ static void _php_curl_reset_handlers(php_curl *ch)
27992804

28002805
if (ZEND_FCC_INITIALIZED(ch->handlers.progress)) {
28012806
zend_fcc_dtor(&ch->handlers.progress);
2807+
ch->handlers.progress = empty_fcall_info_cache;
28022808
}
28032809

28042810
if (ZEND_FCC_INITIALIZED(ch->handlers.xferinfo)) {
28052811
zend_fcc_dtor(&ch->handlers.xferinfo);
2806-
ch->handlers.xferinfo.function_handler = NULL;
2812+
ch->handlers.xferinfo = empty_fcall_info_cache;
28072813
}
28082814

28092815
if (ZEND_FCC_INITIALIZED(ch->handlers.fnmatch)) {
28102816
zend_fcc_dtor(&ch->handlers.fnmatch);
2817+
ch->handlers.fnmatch = empty_fcall_info_cache;
28112818
}
28122819

28132820
#if LIBCURL_VERSION_NUM >= 0x075400 /* Available since 7.84.0 */
28142821
if (ZEND_FCC_INITIALIZED(ch->handlers.sshhostkey)) {
28152822
zend_fcc_dtor(&ch->handlers.sshhostkey);
2823+
ch->handlers.sshhostkey = empty_fcall_info_cache;
28162824
}
28172825
#endif
28182826
}

ext/curl/multi.c

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -390,8 +390,7 @@ static int _php_server_push_callback(CURL *parent_ch, CURL *easy, size_t num_hea
390390

391391
array_init(&headers);
392392
for (size_t i = 0; i < num_headers; i++) {
393-
char *header;
394-
header = curl_pushheader_bynum(push_headers, i);
393+
char *header = curl_pushheader_bynum(push_headers, i);
395394
add_next_index_string(&headers, header);
396395
}
397396

0 commit comments

Comments
 (0)