Skip to content

Commit 50af7c7

Browse files
thg2kGirgias
authored andcommitted
curl: Fix coding style
1 parent 8422224 commit 50af7c7

File tree

4 files changed

+44
-42
lines changed

4 files changed

+44
-42
lines changed

ext/curl/curl.stub.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3133,7 +3133,7 @@
31333133
*/
31343134
const CURLOPT_TLS13_CIPHERS = UNKNOWN;
31353135

3136-
#if LIBCURL_VERSION_NUM >= 0x073E00 /* Available since 7.62.0 */
3136+
#if LIBCURL_VERSION_NUM >= 0x073e00 /* Available since 7.62.0 */
31373137
/**
31383138
* @var int
31393139
* @cvalue CURLOPT_DOH_URL
@@ -3769,7 +3769,7 @@ function curl_getinfo(CurlHandle $handle, ?int $option = null): mixed {}
37693769
/** @refcount 1 */
37703770
function curl_init(?string $url = null): CurlHandle|false {}
37713771

3772-
#if LIBCURL_VERSION_NUM >= 0x073E00 /* Available since 7.62.0 */
3772+
#if LIBCURL_VERSION_NUM >= 0x073e00 /* Available since 7.62.0 */
37733773
function curl_upkeep(CurlHandle $handle): bool {}
37743774
#endif
37753775

ext/curl/curl_arginfo.h

Lines changed: 5 additions & 5 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

ext/curl/interface.c

Lines changed: 37 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -237,7 +237,7 @@ PHP_MINFO_FUNCTION(curl)
237237

238238
d = curl_version_info(CURLVERSION_NOW);
239239
php_info_print_table_start();
240-
php_info_print_table_row(2, "cURL support", "enabled");
240+
php_info_print_table_row(2, "cURL support", "enabled");
241241
php_info_print_table_row(2, "cURL Information", d->version);
242242
snprintf(str, sizeof(str), "%d", d->age);
243243
php_info_print_table_row(2, "Age", str);
@@ -483,6 +483,7 @@ static HashTable *curl_get_gc(zend_object *object, zval **table, int *n)
483483
zend_get_gc_buffer_add_fcc(gc_buffer, &curl->handlers.prereq);
484484
}
485485
#endif
486+
486487
#if LIBCURL_VERSION_NUM >= 0x075400 /* Available since 7.84.0 */
487488
if (ZEND_FCC_INITIALIZED(curl->handlers.sshhostkey)) {
488489
zend_get_gc_buffer_add_fcc(gc_buffer, &curl->handlers.sshhostkey);
@@ -685,8 +686,8 @@ static int curl_prereqfunction(void *clientp, char *conn_primary_ip, char *conn_
685686
// gets called. Return CURL_PREREQFUNC_OK immediately in this case to avoid
686687
// zend_call_known_fcc() with an uninitialized FCC.
687688
if (!ZEND_FCC_INITIALIZED(ch->handlers.prereq)) {
688-
return rval;
689-
}
689+
return rval;
690+
}
690691

691692
#if PHP_CURL_DEBUG
692693
fprintf(stderr, "curl_prereqfunction() called\n");
@@ -881,42 +882,42 @@ static int curl_debug(CURL *handle, curl_infotype type, char *data, size_t size,
881882
{
882883
php_curl *ch = (php_curl *)clientp;
883884

884-
#if PHP_CURL_DEBUG
885-
fprintf(stderr, "curl_debug() called\n");
886-
fprintf(stderr, "type = %d, data = %s\n", type, data);
887-
#endif
885+
#if PHP_CURL_DEBUG
886+
fprintf(stderr, "curl_debug() called\n");
887+
fprintf(stderr, "type = %d, data = %s\n", type, data);
888+
#endif
888889

889890
// Implicitly store the headers for compatibility with CURLINFO_HEADER_OUT
890891
// used as a Curl option. Previously, setting CURLINFO_HEADER_OUT set curl_debug
891892
// as the CURLOPT_DEBUGFUNCTION and stored the debug data when type is set to
892893
// CURLINFO_HEADER_OUT. For backward compatibility, we now store the headers
893894
// but also call the user-callback function if available.
894-
if (type == CURLINFO_HEADER_OUT) {
895-
if (ch->header.str) {
896-
zend_string_release_ex(ch->header.str, 0);
897-
}
898-
ch->header.str = zend_string_init(data, size, 0);
899-
}
895+
if (type == CURLINFO_HEADER_OUT) {
896+
if (ch->header.str) {
897+
zend_string_release_ex(ch->header.str, 0);
898+
}
899+
ch->header.str = zend_string_init(data, size, 0);
900+
}
900901

901-
if (!ZEND_FCC_INITIALIZED(ch->handlers.debug)) {
902-
return 0;
903-
}
902+
if (!ZEND_FCC_INITIALIZED(ch->handlers.debug)) {
903+
return 0;
904+
}
904905

905-
zval args[3];
906+
zval args[3];
906907

907-
GC_ADDREF(&ch->std);
908-
ZVAL_OBJ(&args[0], &ch->std);
909-
ZVAL_LONG(&args[1], type);
910-
ZVAL_STRINGL(&args[2], data, size);
908+
GC_ADDREF(&ch->std);
909+
ZVAL_OBJ(&args[0], &ch->std);
910+
ZVAL_LONG(&args[1], type);
911+
ZVAL_STRINGL(&args[2], data, size);
911912

912-
ch->in_callback = true;
913-
zend_call_known_fcc(&ch->handlers.debug, NULL, /* param_count */ 3, args, /* named_params */ NULL);
914-
ch->in_callback = false;
913+
ch->in_callback = true;
914+
zend_call_known_fcc(&ch->handlers.debug, NULL, /* param_count */ 3, args, /* named_params */ NULL);
915+
ch->in_callback = false;
915916

916-
zval_ptr_dtor(&args[0]);
917-
zval_ptr_dtor(&args[2]);
917+
zval_ptr_dtor(&args[0]);
918+
zval_ptr_dtor(&args[2]);
918919

919-
return 0;
920+
return 0;
920921
}
921922
/* }}} */
922923

@@ -1753,7 +1754,7 @@ static zend_result _php_curl_setopt(php_curl *ch, zend_long option, zval *zvalue
17531754
case CURLOPT_DNS_SHUFFLE_ADDRESSES:
17541755
case CURLOPT_HAPROXYPROTOCOL:
17551756
case CURLOPT_DISALLOW_USERNAME_IN_URL:
1756-
#if LIBCURL_VERSION_NUM >= 0x073E00 /* Available since 7.62.0 */
1757+
#if LIBCURL_VERSION_NUM >= 0x073e00 /* Available since 7.62.0 */
17571758
case CURLOPT_UPKEEP_INTERVAL_MS:
17581759
case CURLOPT_UPLOAD_BUFFERSIZE:
17591760
#endif
@@ -1917,7 +1918,7 @@ static zend_result _php_curl_setopt(php_curl *ch, zend_long option, zval *zvalue
19171918
case CURLOPT_DNS_LOCAL_IP6:
19181919
case CURLOPT_XOAUTH2_BEARER:
19191920
case CURLOPT_UNIX_SOCKET_PATH:
1920-
#if LIBCURL_VERSION_NUM >= 0x073E00 /* Available since 7.62.0 */
1921+
#if LIBCURL_VERSION_NUM >= 0x073e00 /* Available since 7.62.0 */
19211922
case CURLOPT_DOH_URL:
19221923
#endif
19231924
#if LIBCURL_VERSION_NUM >= 0x074a00 /* Available since 7.74.0 */
@@ -2222,9 +2223,9 @@ static zend_result _php_curl_setopt(php_curl *ch, zend_long option, zval *zvalue
22222223

22232224
case CURLINFO_HEADER_OUT:
22242225
if (ZEND_FCC_INITIALIZED(ch->handlers.debug)) {
2225-
zend_value_error("CURLINFO_HEADER_OUT option must not be set when the CURLOPT_DEBUGFUNCTION option is set");
2226-
return FAILURE;
2227-
}
2226+
zend_value_error("CURLINFO_HEADER_OUT option must not be set when the CURLOPT_DEBUGFUNCTION option is set");
2227+
return FAILURE;
2228+
}
22282229

22292230
if (zend_is_true(zvalue)) {
22302231
curl_easy_setopt(ch->cp, CURLOPT_DEBUGFUNCTION, curl_debug);
@@ -2931,11 +2932,13 @@ static void _php_curl_reset_handlers(php_curl *ch)
29312932
if (ZEND_FCC_INITIALIZED(ch->handlers.debug)) {
29322933
zend_fcc_dtor(&ch->handlers.debug);
29332934
}
2935+
29342936
#if LIBCURL_VERSION_NUM >= 0x075000 /* Available since 7.80.0 */
29352937
if (ZEND_FCC_INITIALIZED(ch->handlers.prereq)) {
29362938
zend_fcc_dtor(&ch->handlers.prereq);
29372939
}
29382940
#endif
2941+
29392942
#if LIBCURL_VERSION_NUM >= 0x075400 /* Available since 7.84.0 */
29402943
if (ZEND_FCC_INITIALIZED(ch->handlers.sshhostkey)) {
29412944
zend_fcc_dtor(&ch->handlers.sshhostkey);
@@ -3042,7 +3045,7 @@ PHP_FUNCTION(curl_pause)
30423045
}
30433046
/* }}} */
30443047

3045-
#if LIBCURL_VERSION_NUM >= 0x073E00 /* Available since 7.62.0 */
3048+
#if LIBCURL_VERSION_NUM >= 0x073e00 /* Available since 7.62.0 */
30463049
/* {{{ perform connection upkeep checks */
30473050
PHP_FUNCTION(curl_upkeep)
30483051
{
@@ -3061,5 +3064,5 @@ PHP_FUNCTION(curl_upkeep)
30613064

30623065
RETURN_BOOL(error == CURLE_OK);
30633066
}
3064-
/*}}} */
3067+
/* }}} */
30653068
#endif

ext/curl/multi.c

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -398,7 +398,6 @@ PHP_FUNCTION(curl_multi_strerror)
398398
}
399399
/* }}} */
400400

401-
402401
static int _php_server_push_callback(CURL *parent_ch, CURL *easy, size_t num_headers, struct curl_pushheaders *push_headers, void *userp) /* {{{ */
403402
{
404403
php_curl *ch;

0 commit comments

Comments
 (0)