@@ -241,7 +241,7 @@ static void curl_free_obj(zend_object *object);
241
241
static HashTable * curl_get_gc (zend_object * object , zval * * table , int * n );
242
242
static zend_function * curl_get_constructor (zend_object * object );
243
243
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 );
245
245
static inline int build_mime_structure_from_hash (php_curl * ch , zval * zpostfields );
246
246
247
247
static const zend_function_entry curl_object_methods [] = {
@@ -1243,7 +1243,7 @@ static zend_object *curl_clone_obj(zend_object *object) {
1243
1243
1244
1244
clone_object = curl_create_object (curl_ce );
1245
1245
clone_ch = curl_from_obj (clone_object );
1246
- clone_ch = alloc_curl_handle (clone_ch );
1246
+ init_curl_handle (clone_ch );
1247
1247
1248
1248
ch = curl_from_obj (object );
1249
1249
cp = curl_easy_duphandle (ch -> cp );
@@ -1728,17 +1728,19 @@ PHP_FUNCTION(curl_version)
1728
1728
}
1729
1729
/* }}} */
1730
1730
1731
- php_curl * alloc_curl_handle_from_zval (zval * curl )
1731
+ php_curl * init_curl_handle_into_zval (zval * curl )
1732
1732
{
1733
1733
php_curl * ch ;
1734
1734
1735
1735
object_init_ex (curl , curl_ce );
1736
1736
ch = Z_CURL_P (curl );
1737
1737
1738
- return alloc_curl_handle (ch );
1738
+ init_curl_handle (ch );
1739
+
1740
+ return ch ;
1739
1741
}
1740
1742
1741
- php_curl * alloc_curl_handle (php_curl * ch )
1743
+ void init_curl_handle (php_curl * ch )
1742
1744
{
1743
1745
ch -> to_free = ecalloc (1 , sizeof (struct _php_curl_free ));
1744
1746
ch -> handlers = ecalloc (1 , sizeof (php_curl_handlers ));
@@ -1759,8 +1761,6 @@ php_curl *alloc_curl_handle(php_curl *ch)
1759
1761
ch -> to_free -> slist = emalloc (sizeof (HashTable ));
1760
1762
zend_hash_init (ch -> to_free -> slist , 4 , NULL , curl_free_slist , 0 );
1761
1763
ZVAL_UNDEF (& ch -> postfields );
1762
-
1763
- return ch ;
1764
1764
}
1765
1765
1766
1766
/* }}} */
@@ -1853,7 +1853,7 @@ PHP_FUNCTION(curl_init)
1853
1853
RETURN_FALSE ;
1854
1854
}
1855
1855
1856
- ch = alloc_curl_handle_from_zval (return_value );
1856
+ ch = init_curl_handle_into_zval (return_value );
1857
1857
1858
1858
ch -> cp = cp ;
1859
1859
@@ -2058,8 +2058,8 @@ static inline int build_mime_structure_from_hash(php_curl *ch, zval *zpostfields
2058
2058
filename = Z_STRVAL_P (prop );
2059
2059
}
2060
2060
2061
- zval_ptr_dtor (& ch -> postfields );
2062
2061
#if LIBCURL_VERSION_NUM >= 0x073800 /* 7.56.0 */
2062
+ zval_ptr_dtor (& ch -> postfields );
2063
2063
ZVAL_COPY (& ch -> postfields , zpostfields );
2064
2064
2065
2065
if ((stream = php_stream_open_wrapper (ZSTR_VAL (postval ), "rb" , STREAM_MUST_SEEK , NULL ))) {
@@ -2181,7 +2181,7 @@ PHP_FUNCTION(curl_copy_handle)
2181
2181
RETURN_FALSE ;
2182
2182
}
2183
2183
2184
- dupch = alloc_curl_handle_from_zval (return_value );
2184
+ dupch = init_curl_handle_into_zval (return_value );
2185
2185
dupch -> cp = cp ;
2186
2186
2187
2187
_php_setup_easy_copy_handlers (dupch , ch );
@@ -2826,8 +2826,6 @@ static int _php_curl_setopt(php_curl *ch, zend_long option, zval *zvalue) /* {{{
2826
2826
if (Z_TYPE_P (zvalue ) == IS_OBJECT && Z_OBJCE_P (zvalue ) == curl_share_ce ) {
2827
2827
php_curlsh * sh = Z_CURL_SHARE_P (zvalue );
2828
2828
curl_easy_setopt (ch -> cp , CURLOPT_SHARE , sh -> share );
2829
- } else {
2830
- return FAILURE ;
2831
2829
}
2832
2830
}
2833
2831
break ;
0 commit comments