Skip to content

Commit

Permalink
Fix another batch of comments
Browse files Browse the repository at this point in the history
  • Loading branch information
kocsismate committed Apr 24, 2020
1 parent 5af8bbf commit bdc7120
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 16 deletions.
22 changes: 10 additions & 12 deletions ext/curl/interface.c
Original file line number Diff line number Diff line change
Expand Up @@ -241,7 +241,7 @@ static void curl_free_obj(zend_object *object);
static HashTable *curl_get_gc(zend_object *object, zval **table, int *n);
static zend_function *curl_get_constructor(zend_object *object);
static zend_object *curl_clone_obj(zend_object *object);
php_curl *alloc_curl_handle_from_zval(zval *curl);
php_curl *init_curl_handle_into_zval(zval *curl);
static inline int build_mime_structure_from_hash(php_curl *ch, zval *zpostfields);

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

clone_object = curl_create_object(curl_ce);
clone_ch = curl_from_obj(clone_object);
clone_ch = alloc_curl_handle(clone_ch);
init_curl_handle(clone_ch);

ch = curl_from_obj(object);
cp = curl_easy_duphandle(ch->cp);
Expand Down Expand Up @@ -1728,17 +1728,19 @@ PHP_FUNCTION(curl_version)
}
/* }}} */

php_curl *alloc_curl_handle_from_zval(zval *curl)
php_curl *init_curl_handle_into_zval(zval *curl)
{
php_curl *ch;

object_init_ex(curl, curl_ce);
ch = Z_CURL_P(curl);

return alloc_curl_handle(ch);
init_curl_handle(ch);

return ch;
}

php_curl *alloc_curl_handle(php_curl *ch)
void init_curl_handle(php_curl *ch)
{
ch->to_free = ecalloc(1, sizeof(struct _php_curl_free));
ch->handlers = ecalloc(1, sizeof(php_curl_handlers));
Expand All @@ -1759,8 +1761,6 @@ php_curl *alloc_curl_handle(php_curl *ch)
ch->to_free->slist = emalloc(sizeof(HashTable));
zend_hash_init(ch->to_free->slist, 4, NULL, curl_free_slist, 0);
ZVAL_UNDEF(&ch->postfields);

return ch;
}

/* }}} */
Expand Down Expand Up @@ -1853,7 +1853,7 @@ PHP_FUNCTION(curl_init)
RETURN_FALSE;
}

ch = alloc_curl_handle_from_zval(return_value);
ch = init_curl_handle_into_zval(return_value);

ch->cp = cp;

Expand Down Expand Up @@ -2058,8 +2058,8 @@ static inline int build_mime_structure_from_hash(php_curl *ch, zval *zpostfields
filename = Z_STRVAL_P(prop);
}

zval_ptr_dtor(&ch->postfields);
#if LIBCURL_VERSION_NUM >= 0x073800 /* 7.56.0 */
zval_ptr_dtor(&ch->postfields);
ZVAL_COPY(&ch->postfields, zpostfields);

if ((stream = php_stream_open_wrapper(ZSTR_VAL(postval), "rb", STREAM_MUST_SEEK, NULL))) {
Expand Down Expand Up @@ -2181,7 +2181,7 @@ PHP_FUNCTION(curl_copy_handle)
RETURN_FALSE;
}

dupch = alloc_curl_handle_from_zval(return_value);
dupch = init_curl_handle_into_zval(return_value);
dupch->cp = cp;

_php_setup_easy_copy_handlers(dupch, ch);
Expand Down Expand Up @@ -2826,8 +2826,6 @@ static int _php_curl_setopt(php_curl *ch, zend_long option, zval *zvalue) /* {{{
if (Z_TYPE_P(zvalue) == IS_OBJECT && Z_OBJCE_P(zvalue) == curl_share_ce) {
php_curlsh *sh = Z_CURL_SHARE_P(zvalue);
curl_easy_setopt(ch->cp, CURLOPT_SHARE, sh->share);
} else {
return FAILURE;
}
}
break;
Expand Down
3 changes: 1 addition & 2 deletions ext/curl/multi.c
Original file line number Diff line number Diff line change
Expand Up @@ -398,7 +398,7 @@ static int _php_server_push_callback(CURL *parent_ch, CURL *easy, size_t num_hea

parent = Z_CURL_P(pz_parent_ch);

ch = alloc_curl_handle_from_zval(&pz_ch);
ch = init_curl_handle_into_zval(&pz_ch);
ch->cp = easy;
_php_setup_easy_copy_handlers(ch, parent);

Expand Down Expand Up @@ -559,7 +559,6 @@ void curl_multi_free_obj(zend_object *object)

for (pz_ch = (zval *)zend_llist_get_first_ex(&mh->easyh, &pos); pz_ch;
pz_ch = (zval *)zend_llist_get_next_ex(&mh->easyh, &pos)) {
/* ptr is NULL means it already be freed */
if (Z_OBJ_P(pz_ch)) {
ch = Z_CURL_P(pz_ch);
_php_curl_verify_handlers(ch, 0);
Expand Down
4 changes: 2 additions & 2 deletions ext/curl/php_curl.h
Original file line number Diff line number Diff line change
Expand Up @@ -151,8 +151,8 @@ typedef struct {
zend_object std;
} php_curlsh;

php_curl *alloc_curl_handle_from_zval(zval *curl);
php_curl *alloc_curl_handle(php_curl *ch);
php_curl *init_curl_handle_into_zval(zval *curl);
void init_curl_handle(php_curl *ch);
void _php_curl_cleanup_handle(php_curl *);
void _php_curl_multi_cleanup_list(void *data);
void _php_curl_verify_handlers(php_curl *ch, int reporterror);
Expand Down

0 comments on commit bdc7120

Please sign in to comment.