Skip to content

Commit b2ba31e

Browse files
committed
Fix another batch of comments
1 parent 70c3326 commit b2ba31e

File tree

3 files changed

+13
-16
lines changed

3 files changed

+13
-16
lines changed

ext/curl/interface.c

Lines changed: 10 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -241,7 +241,7 @@ static void curl_free_obj(zend_object *object);
241241
static HashTable *curl_get_gc(zend_object *object, zval **table, int *n);
242242
static zend_function *curl_get_constructor(zend_object *object);
243243
static zend_object *curl_clone_obj(zend_object *object);
244-
php_curl *alloc_curl_handle_from_zval(zval *curl);
244+
php_curl *init_curl_handle_into_zval(zval *curl);
245245
static inline int build_mime_structure_from_hash(php_curl *ch, zval *zpostfields);
246246

247247
static const zend_function_entry curl_object_methods[] = {
@@ -1243,7 +1243,7 @@ static zend_object *curl_clone_obj(zend_object *object) {
12431243

12441244
clone_object = curl_create_object(curl_ce);
12451245
clone_ch = curl_from_obj(clone_object);
1246-
clone_ch = alloc_curl_handle(clone_ch);
1246+
init_curl_handle(clone_ch);
12471247

12481248
ch = curl_from_obj(object);
12491249
cp = curl_easy_duphandle(ch->cp);
@@ -1728,17 +1728,19 @@ PHP_FUNCTION(curl_version)
17281728
}
17291729
/* }}} */
17301730

1731-
php_curl *alloc_curl_handle_from_zval(zval *curl)
1731+
php_curl *init_curl_handle_into_zval(zval *curl)
17321732
{
17331733
php_curl *ch;
17341734

17351735
object_init_ex(curl, curl_ce);
17361736
ch = Z_CURL_P(curl);
17371737

1738-
return alloc_curl_handle(ch);
1738+
init_curl_handle(ch);
1739+
1740+
return ch;
17391741
}
17401742

1741-
php_curl *alloc_curl_handle(php_curl *ch)
1743+
void init_curl_handle(php_curl *ch)
17421744
{
17431745
ch->to_free = ecalloc(1, sizeof(struct _php_curl_free));
17441746
ch->handlers = ecalloc(1, sizeof(php_curl_handlers));
@@ -1759,8 +1761,6 @@ php_curl *alloc_curl_handle(php_curl *ch)
17591761
ch->to_free->slist = emalloc(sizeof(HashTable));
17601762
zend_hash_init(ch->to_free->slist, 4, NULL, curl_free_slist, 0);
17611763
ZVAL_UNDEF(&ch->postfields);
1762-
1763-
return ch;
17641764
}
17651765

17661766
/* }}} */
@@ -1853,7 +1853,7 @@ PHP_FUNCTION(curl_init)
18531853
RETURN_FALSE;
18541854
}
18551855

1856-
ch = alloc_curl_handle_from_zval(return_value);
1856+
ch = init_curl_handle_into_zval(return_value);
18571857

18581858
ch->cp = cp;
18591859

@@ -2058,8 +2058,8 @@ static inline int build_mime_structure_from_hash(php_curl *ch, zval *zpostfields
20582058
filename = Z_STRVAL_P(prop);
20592059
}
20602060

2061-
zval_ptr_dtor(&ch->postfields);
20622061
#if LIBCURL_VERSION_NUM >= 0x073800 /* 7.56.0 */
2062+
zval_ptr_dtor(&ch->postfields);
20632063
ZVAL_COPY(&ch->postfields, zpostfields);
20642064

20652065
if ((stream = php_stream_open_wrapper(ZSTR_VAL(postval), "rb", STREAM_MUST_SEEK, NULL))) {
@@ -2181,7 +2181,7 @@ PHP_FUNCTION(curl_copy_handle)
21812181
RETURN_FALSE;
21822182
}
21832183

2184-
dupch = alloc_curl_handle_from_zval(return_value);
2184+
dupch = init_curl_handle_into_zval(return_value);
21852185
dupch->cp = cp;
21862186

21872187
_php_setup_easy_copy_handlers(dupch, ch);
@@ -2826,8 +2826,6 @@ static int _php_curl_setopt(php_curl *ch, zend_long option, zval *zvalue) /* {{{
28262826
if (Z_TYPE_P(zvalue) == IS_OBJECT && Z_OBJCE_P(zvalue) == curl_share_ce) {
28272827
php_curlsh *sh = Z_CURL_SHARE_P(zvalue);
28282828
curl_easy_setopt(ch->cp, CURLOPT_SHARE, sh->share);
2829-
} else {
2830-
return FAILURE;
28312829
}
28322830
}
28332831
break;

ext/curl/multi.c

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

399399
parent = Z_CURL_P(pz_parent_ch);
400400

401-
ch = alloc_curl_handle_from_zval(&pz_ch);
401+
ch = init_curl_handle_into_zval(&pz_ch);
402402
ch->cp = easy;
403403
_php_setup_easy_copy_handlers(ch, parent);
404404

@@ -559,7 +559,6 @@ void curl_multi_free_obj(zend_object *object)
559559

560560
for (pz_ch = (zval *)zend_llist_get_first_ex(&mh->easyh, &pos); pz_ch;
561561
pz_ch = (zval *)zend_llist_get_next_ex(&mh->easyh, &pos)) {
562-
/* ptr is NULL means it already be freed */
563562
if (Z_OBJ_P(pz_ch)) {
564563
ch = Z_CURL_P(pz_ch);
565564
_php_curl_verify_handlers(ch, 0);

ext/curl/php_curl.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -151,8 +151,8 @@ typedef struct {
151151
zend_object std;
152152
} php_curlsh;
153153

154-
php_curl *alloc_curl_handle_from_zval(zval *curl);
155-
php_curl *alloc_curl_handle(php_curl *ch);
154+
php_curl *init_curl_handle_into_zval(zval *curl);
155+
void init_curl_handle(php_curl *ch);
156156
void _php_curl_cleanup_handle(php_curl *);
157157
void _php_curl_multi_cleanup_list(void *data);
158158
void _php_curl_verify_handlers(php_curl *ch, int reporterror);

0 commit comments

Comments
 (0)