Skip to content

Commit cdc385d

Browse files
ci: format code
1 parent 260e487 commit cdc385d

File tree

210 files changed

+28016
-30153
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

210 files changed

+28016
-30153
lines changed

src/api/cURL/docs/examples/10-at-a-time.c

+97-104
Original file line numberDiff line numberDiff line change
@@ -26,128 +26,121 @@
2626
* </DESC>
2727
*/
2828

29+
#include <curl/curl.h>
2930
#include <stdlib.h>
3031
#include <string.h>
31-
#include <curl/curl.h>
3232

3333
static const char *urls[] = {
34-
"https://www.microsoft.com",
35-
"https://opensource.org",
36-
"https://www.google.com",
37-
"https://www.yahoo.com",
38-
"https://www.ibm.com",
39-
"https://www.mysql.com",
40-
"https://www.oracle.com",
41-
"https://www.ripe.net",
42-
"https://www.iana.org",
43-
"https://www.amazon.com",
44-
"https://www.netcraft.com",
45-
"https://www.heise.de",
46-
"https://www.chip.de",
47-
"https://www.ca.com",
48-
"https://www.cnet.com",
49-
"https://www.mozilla.org",
50-
"https://www.cnn.com",
51-
"https://www.wikipedia.org",
52-
"https://www.dell.com",
53-
"https://www.hp.com",
54-
"https://www.cert.org",
55-
"https://www.mit.edu",
56-
"https://www.nist.gov",
57-
"https://www.ebay.com",
58-
"https://www.playstation.com",
59-
"https://www.uefa.com",
60-
"https://www.ieee.org",
61-
"https://www.apple.com",
62-
"https://www.symantec.com",
63-
"https://www.zdnet.com",
64-
"https://www.fujitsu.com/global/",
65-
"https://www.supermicro.com",
66-
"https://www.hotmail.com",
67-
"https://www.ietf.org",
68-
"https://www.bbc.co.uk",
69-
"https://news.google.com",
70-
"https://www.foxnews.com",
71-
"https://www.msn.com",
72-
"https://www.wired.com",
73-
"https://www.sky.com",
74-
"https://www.usatoday.com",
75-
"https://www.cbs.com",
76-
"https://www.nbc.com/",
77-
"https://slashdot.org",
78-
"https://www.informationweek.com",
79-
"https://apache.org",
80-
"https://www.un.org",
34+
"https://www.microsoft.com",
35+
"https://opensource.org",
36+
"https://www.google.com",
37+
"https://www.yahoo.com",
38+
"https://www.ibm.com",
39+
"https://www.mysql.com",
40+
"https://www.oracle.com",
41+
"https://www.ripe.net",
42+
"https://www.iana.org",
43+
"https://www.amazon.com",
44+
"https://www.netcraft.com",
45+
"https://www.heise.de",
46+
"https://www.chip.de",
47+
"https://www.ca.com",
48+
"https://www.cnet.com",
49+
"https://www.mozilla.org",
50+
"https://www.cnn.com",
51+
"https://www.wikipedia.org",
52+
"https://www.dell.com",
53+
"https://www.hp.com",
54+
"https://www.cert.org",
55+
"https://www.mit.edu",
56+
"https://www.nist.gov",
57+
"https://www.ebay.com",
58+
"https://www.playstation.com",
59+
"https://www.uefa.com",
60+
"https://www.ieee.org",
61+
"https://www.apple.com",
62+
"https://www.symantec.com",
63+
"https://www.zdnet.com",
64+
"https://www.fujitsu.com/global/",
65+
"https://www.supermicro.com",
66+
"https://www.hotmail.com",
67+
"https://www.ietf.org",
68+
"https://www.bbc.co.uk",
69+
"https://news.google.com",
70+
"https://www.foxnews.com",
71+
"https://www.msn.com",
72+
"https://www.wired.com",
73+
"https://www.sky.com",
74+
"https://www.usatoday.com",
75+
"https://www.cbs.com",
76+
"https://www.nbc.com/",
77+
"https://slashdot.org",
78+
"https://www.informationweek.com",
79+
"https://apache.org",
80+
"https://www.un.org",
8181
};
8282

8383
#define MAX_PARALLEL 10 /* number of simultaneous transfers */
84-
#define NUM_URLS sizeof(urls)/sizeof(char *)
84+
#define NUM_URLS sizeof(urls) / sizeof(char *)
8585

86-
static size_t write_cb(char *data, size_t n, size_t l, void *userp)
87-
{
88-
/* take care of the data here, ignored in this example */
89-
(void)data;
90-
(void)userp;
91-
return n*l;
86+
static size_t write_cb(char *data, size_t n, size_t l, void *userp) {
87+
/* take care of the data here, ignored in this example */
88+
(void)data;
89+
(void)userp;
90+
return n * l;
9291
}
9392

94-
static void add_transfer(CURLM *cm, unsigned int i, int *left)
95-
{
96-
CURL *eh = curl_easy_init();
97-
curl_easy_setopt(eh, CURLOPT_WRITEFUNCTION, write_cb);
98-
curl_easy_setopt(eh, CURLOPT_URL, urls[i]);
99-
curl_easy_setopt(eh, CURLOPT_PRIVATE, urls[i]);
100-
curl_multi_add_handle(cm, eh);
101-
(*left)++;
93+
static void add_transfer(CURLM *cm, unsigned int i, int *left) {
94+
CURL *eh = curl_easy_init();
95+
curl_easy_setopt(eh, CURLOPT_WRITEFUNCTION, write_cb);
96+
curl_easy_setopt(eh, CURLOPT_URL, urls[i]);
97+
curl_easy_setopt(eh, CURLOPT_PRIVATE, urls[i]);
98+
curl_multi_add_handle(cm, eh);
99+
(*left)++;
102100
}
103101

104-
int main(void)
105-
{
106-
CURLM *cm;
107-
CURLMsg *msg;
108-
unsigned int transfers = 0;
109-
int msgs_left = -1;
110-
int left = 0;
102+
int main(void) {
103+
CURLM *cm;
104+
CURLMsg *msg;
105+
unsigned int transfers = 0;
106+
int msgs_left = -1;
107+
int left = 0;
111108

112-
curl_global_init(CURL_GLOBAL_ALL);
113-
cm = curl_multi_init();
109+
curl_global_init(CURL_GLOBAL_ALL);
110+
cm = curl_multi_init();
114111

115-
/* Limit the amount of simultaneous connections curl should allow: */
116-
curl_multi_setopt(cm, CURLMOPT_MAXCONNECTS, (long)MAX_PARALLEL);
112+
/* Limit the amount of simultaneous connections curl should allow: */
113+
curl_multi_setopt(cm, CURLMOPT_MAXCONNECTS, (long)MAX_PARALLEL);
117114

118-
for(transfers = 0; transfers < MAX_PARALLEL && transfers < NUM_URLS;
119-
transfers++)
120-
add_transfer(cm, transfers, &left);
115+
for (transfers = 0; transfers < MAX_PARALLEL && transfers < NUM_URLS; transfers++)
116+
add_transfer(cm, transfers, &left);
121117

122-
do {
123-
int still_alive = 1;
124-
curl_multi_perform(cm, &still_alive);
118+
do {
119+
int still_alive = 1;
120+
curl_multi_perform(cm, &still_alive);
125121

126-
/* !checksrc! disable EQUALSNULL 1 */
127-
while((msg = curl_multi_info_read(cm, &msgs_left)) != NULL) {
128-
if(msg->msg == CURLMSG_DONE) {
129-
char *url;
130-
CURL *e = msg->easy_handle;
131-
curl_easy_getinfo(msg->easy_handle, CURLINFO_PRIVATE, &url);
132-
fprintf(stderr, "R: %d - %s <%s>\n",
133-
msg->data.result, curl_easy_strerror(msg->data.result), url);
134-
curl_multi_remove_handle(cm, e);
135-
curl_easy_cleanup(e);
136-
left--;
137-
}
138-
else {
139-
fprintf(stderr, "E: CURLMsg (%d)\n", msg->msg);
140-
}
141-
if(transfers < NUM_URLS)
142-
add_transfer(cm, transfers++, &left);
143-
}
144-
if(left)
145-
curl_multi_wait(cm, NULL, 0, 1000, NULL);
122+
/* !checksrc! disable EQUALSNULL 1 */
123+
while ((msg = curl_multi_info_read(cm, &msgs_left)) != NULL) {
124+
if (msg->msg == CURLMSG_DONE) {
125+
char *url;
126+
CURL *e = msg->easy_handle;
127+
curl_easy_getinfo(msg->easy_handle, CURLINFO_PRIVATE, &url);
128+
fprintf(stderr, "R: %d - %s <%s>\n", msg->data.result,
129+
curl_easy_strerror(msg->data.result), url);
130+
curl_multi_remove_handle(cm, e);
131+
curl_easy_cleanup(e);
132+
left--;
133+
} else {
134+
fprintf(stderr, "E: CURLMsg (%d)\n", msg->msg);
135+
}
136+
if (transfers < NUM_URLS) add_transfer(cm, transfers++, &left);
137+
}
138+
if (left) curl_multi_wait(cm, NULL, 0, 1000, NULL);
146139

147-
} while(left);
140+
} while (left);
148141

149-
curl_multi_cleanup(cm);
150-
curl_global_cleanup();
142+
curl_multi_cleanup(cm);
143+
curl_global_cleanup();
151144

152-
return EXIT_SUCCESS;
145+
return EXIT_SUCCESS;
153146
}

src/api/cURL/docs/examples/address-scope.c

+20-22
Original file line numberDiff line numberDiff line change
@@ -25,38 +25,36 @@
2525
* HTTP GET to an IPv6 address with specific scope
2626
* </DESC>
2727
*/
28-
#include <stdio.h>
2928
#include <curl/curl.h>
29+
#include <stdio.h>
3030

3131
#if !defined(_WIN32) && !defined(MSDOS) && !defined(__AMIGA__)
3232
#include <net/if.h>
3333
#endif
3434

35-
int main(void)
36-
{
35+
int main(void) {
3736
#if !defined(_WIN32) && !defined(MSDOS) && !defined(__AMIGA__)
38-
/* Windows/MS-DOS users need to find how to use if_nametoindex() */
39-
CURL *curl;
40-
CURLcode res;
37+
/* Windows/MS-DOS users need to find how to use if_nametoindex() */
38+
CURL *curl;
39+
CURLcode res;
4140

42-
curl = curl_easy_init();
43-
if(curl) {
44-
long my_scope_id;
45-
curl_easy_setopt(curl, CURLOPT_URL, "https://example.com");
41+
curl = curl_easy_init();
42+
if (curl) {
43+
long my_scope_id;
44+
curl_easy_setopt(curl, CURLOPT_URL, "https://example.com");
4645

47-
my_scope_id = (long)if_nametoindex("eth0");
48-
curl_easy_setopt(curl, CURLOPT_ADDRESS_SCOPE, my_scope_id);
46+
my_scope_id = (long)if_nametoindex("eth0");
47+
curl_easy_setopt(curl, CURLOPT_ADDRESS_SCOPE, my_scope_id);
4948

50-
/* Perform the request, res gets the return code */
51-
res = curl_easy_perform(curl);
52-
/* Check for errors */
53-
if(res != CURLE_OK)
54-
fprintf(stderr, "curl_easy_perform() failed: %s\n",
55-
curl_easy_strerror(res));
49+
/* Perform the request, res gets the return code */
50+
res = curl_easy_perform(curl);
51+
/* Check for errors */
52+
if (res != CURLE_OK)
53+
fprintf(stderr, "curl_easy_perform() failed: %s\n", curl_easy_strerror(res));
5654

57-
/* always cleanup */
58-
curl_easy_cleanup(curl);
59-
}
55+
/* always cleanup */
56+
curl_easy_cleanup(curl);
57+
}
6058
#endif
61-
return 0;
59+
return 0;
6260
}

src/api/cURL/docs/examples/altsvc.c

+21-23
Original file line numberDiff line numberDiff line change
@@ -25,34 +25,32 @@
2525
* HTTP with Alt-Svc support
2626
* </DESC>
2727
*/
28-
#include <stdio.h>
2928
#include <curl/curl.h>
29+
#include <stdio.h>
3030

31-
int main(void)
32-
{
33-
CURL *curl;
34-
CURLcode res;
31+
int main(void) {
32+
CURL *curl;
33+
CURLcode res;
3534

36-
curl = curl_easy_init();
37-
if(curl) {
38-
curl_easy_setopt(curl, CURLOPT_URL, "https://example.com");
35+
curl = curl_easy_init();
36+
if (curl) {
37+
curl_easy_setopt(curl, CURLOPT_URL, "https://example.com");
3938

40-
/* cache the alternatives in this file */
41-
curl_easy_setopt(curl, CURLOPT_ALTSVC, "altsvc.txt");
39+
/* cache the alternatives in this file */
40+
curl_easy_setopt(curl, CURLOPT_ALTSVC, "altsvc.txt");
4241

43-
/* restrict which HTTP versions to use alternatives */
44-
curl_easy_setopt(curl, CURLOPT_ALTSVC_CTRL, (long)
45-
CURLALTSVC_H1|CURLALTSVC_H2|CURLALTSVC_H3);
42+
/* restrict which HTTP versions to use alternatives */
43+
curl_easy_setopt(curl, CURLOPT_ALTSVC_CTRL,
44+
(long)CURLALTSVC_H1 | CURLALTSVC_H2 | CURLALTSVC_H3);
4645

47-
/* Perform the request, res gets the return code */
48-
res = curl_easy_perform(curl);
49-
/* Check for errors */
50-
if(res != CURLE_OK)
51-
fprintf(stderr, "curl_easy_perform() failed: %s\n",
52-
curl_easy_strerror(res));
46+
/* Perform the request, res gets the return code */
47+
res = curl_easy_perform(curl);
48+
/* Check for errors */
49+
if (res != CURLE_OK)
50+
fprintf(stderr, "curl_easy_perform() failed: %s\n", curl_easy_strerror(res));
5351

54-
/* always cleanup */
55-
curl_easy_cleanup(curl);
56-
}
57-
return 0;
52+
/* always cleanup */
53+
curl_easy_cleanup(curl);
54+
}
55+
return 0;
5856
}

0 commit comments

Comments
 (0)