From 3a6563d668406df1703edb4202afc038fcf9d30e Mon Sep 17 00:00:00 2001 From: Daniel Stenberg Date: Thu, 11 Feb 2016 09:42:38 +0100 Subject: examples: adhere to curl code style All plain C examples now (mostly) adhere to the curl code style. While they are only examples, they had diverted so much and contained all sorts of different mixed code styles by now. Having them use a unified style helps users and readability. Also, as they get copy-and-pasted widely by users, making sure they're clean and nice is a good idea. 573 checksrc warnings were addressed. --- docs/examples/cookie_interface.c | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) (limited to 'docs/examples/cookie_interface.c') diff --git a/docs/examples/cookie_interface.c b/docs/examples/cookie_interface.c index 5181f3fd0..064c7b329 100644 --- a/docs/examples/cookie_interface.c +++ b/docs/examples/cookie_interface.c @@ -42,18 +42,18 @@ print_cookies(CURL *curl) printf("Cookies, curl knows:\n"); res = curl_easy_getinfo(curl, CURLINFO_COOKIELIST, &cookies); - if (res != CURLE_OK) { + if(res != CURLE_OK) { fprintf(stderr, "Curl curl_easy_getinfo failed: %s\n", curl_easy_strerror(res)); exit(1); } nc = cookies, i = 1; - while (nc) { + while(nc) { printf("[%d]: %s\n", i, nc->data); nc = nc->next; i++; } - if (i == 1) { + if(i == 1) { printf("(none)\n"); } curl_slist_free_all(cookies); @@ -67,14 +67,14 @@ main(void) curl_global_init(CURL_GLOBAL_ALL); curl = curl_easy_init(); - if (curl) { + if(curl) { char nline[256]; curl_easy_setopt(curl, CURLOPT_URL, "http://www.example.com/"); curl_easy_setopt(curl, CURLOPT_VERBOSE, 1L); curl_easy_setopt(curl, CURLOPT_COOKIEFILE, ""); /* start cookie engine */ res = curl_easy_perform(curl); - if (res != CURLE_OK) { + if(res != CURLE_OK) { fprintf(stderr, "Curl perform failed: %s\n", curl_easy_strerror(res)); return 1; } @@ -97,7 +97,7 @@ main(void) (unsigned long)time(NULL) + 31337UL, "PREF", "hello google, i like you very much!"); res = curl_easy_setopt(curl, CURLOPT_COOKIELIST, nline); - if (res != CURLE_OK) { + if(res != CURLE_OK) { fprintf(stderr, "Curl curl_easy_setopt failed: %s\n", curl_easy_strerror(res)); return 1; @@ -113,7 +113,7 @@ main(void) "Set-Cookie: OLD_PREF=3d141414bf4209321; " "expires=Sun, 17-Jan-2038 19:14:07 GMT; path=/; domain=.google.com"); res = curl_easy_setopt(curl, CURLOPT_COOKIELIST, nline); - if (res != CURLE_OK) { + if(res != CURLE_OK) { fprintf(stderr, "Curl curl_easy_setopt failed: %s\n", curl_easy_strerror(res)); return 1; @@ -122,7 +122,7 @@ main(void) print_cookies(curl); res = curl_easy_perform(curl); - if (res != CURLE_OK) { + if(res != CURLE_OK) { fprintf(stderr, "Curl perform failed: %s\n", curl_easy_strerror(res)); return 1; } -- cgit v1.2.3