diff options
author | Steve Holme <steve_holme@hotmail.com> | 2014-10-28 22:42:42 +0000 |
---|---|---|
committer | Steve Holme <steve_holme@hotmail.com> | 2014-10-28 22:45:32 +0000 |
commit | 085081fc6e7da0b43c2bc1930c643dd7efb7f2cc (patch) | |
tree | 54cb71294c863add2b8c19f77ed1108b8905087d | |
parent | b790bdf46b7b3c9f5269163b25505f7b9ae1e319 (diff) |
code cleanup: We prefer 'CURLcode result'
-rw-r--r-- | lib/connect.c | 30 | ||||
-rw-r--r-- | lib/escape.c | 15 | ||||
-rw-r--r-- | lib/http_digest.c | 18 | ||||
-rw-r--r-- | lib/pipeline.c | 6 |
4 files changed, 36 insertions, 33 deletions
diff --git a/lib/connect.c b/lib/connect.c index f62d96530..a8fe83042 100644 --- a/lib/connect.c +++ b/lib/connect.c @@ -977,10 +977,9 @@ void Curl_sndbufset(curl_socket_t sockfd) * singleipconnect() connects to the given IP only, and it may return without * having connected. */ -static CURLcode -singleipconnect(struct connectdata *conn, - const Curl_addrinfo *ai, - curl_socket_t *sockp) +static CURLcode singleipconnect(struct connectdata *conn, + const Curl_addrinfo *ai, + curl_socket_t *sockp) { struct Curl_sockaddr_ex addr; int rc; @@ -988,14 +987,14 @@ singleipconnect(struct connectdata *conn, bool isconnected = FALSE; struct SessionHandle *data = conn->data; curl_socket_t sockfd; - CURLcode res; + CURLcode result; char ipaddress[MAX_IPADR_LEN]; long port; *sockp = CURL_SOCKET_BAD; - res = Curl_socket(conn, ai, &addr, &sockfd); - if(res) + result = Curl_socket(conn, ai, &addr, &sockfd); + if(result) /* Failed to create the socket, but still return OK since we signal the lack of socket as well. This allows the parent function to keep looping over alternative addresses/socket families etc. */ @@ -1038,15 +1037,16 @@ singleipconnect(struct connectdata *conn, } /* possibly bind the local end to an IP, interface or port */ - res = bindlocal(conn, sockfd, addr.family); - if(res) { + result = bindlocal(conn, sockfd, addr.family); + if(result) { Curl_closesocket(conn, sockfd); /* close socket and bail out */ - if(res == CURLE_UNSUPPORTED_PROTOCOL) { + if(result == CURLE_UNSUPPORTED_PROTOCOL) { /* The address family is not supported on this interface. We can continue trying addresses */ return CURLE_OK; } - return res; + + return result; } /* set socket non-blocking */ @@ -1084,7 +1084,7 @@ singleipconnect(struct connectdata *conn, case EAGAIN: #endif #endif - res = CURLE_OK; + result = CURLE_OK; break; default: @@ -1095,14 +1095,14 @@ singleipconnect(struct connectdata *conn, /* connect failed */ Curl_closesocket(conn, sockfd); - res = CURLE_COULDNT_CONNECT; + result = CURLE_COULDNT_CONNECT; } } - if(!res) + if(!result) *sockp = sockfd; - return res; + return result; } /* diff --git a/lib/escape.c b/lib/escape.c index d7f8a8f54..9923e64cf 100644 --- a/lib/escape.c +++ b/lib/escape.c @@ -87,7 +87,7 @@ char *curl_easy_escape(CURL *handle, const char *string, int inlength) size_t newlen = alloc; size_t strindex=0; size_t length; - CURLcode res; + CURLcode result; ns = malloc(alloc); if(!ns) @@ -115,8 +115,8 @@ char *curl_easy_escape(CURL *handle, const char *string, int inlength) } } - res = Curl_convert_to_network(handle, &in, 1); - if(res) { + result = Curl_convert_to_network(handle, &in, 1); + if(result) { /* Curl_convert_to_network calls failf if unsuccessful */ free(ns); return NULL; @@ -152,7 +152,7 @@ CURLcode Curl_urldecode(struct SessionHandle *data, unsigned char in; size_t strindex=0; unsigned long hex; - CURLcode res; + CURLcode result; if(!ns) return CURLE_OUT_OF_MEMORY; @@ -172,16 +172,17 @@ CURLcode Curl_urldecode(struct SessionHandle *data, in = curlx_ultouc(hex); /* this long is never bigger than 255 anyway */ - res = Curl_convert_from_network(data, &in, 1); - if(res) { + result = Curl_convert_from_network(data, &in, 1); + if(result) { /* Curl_convert_from_network calls failf if unsuccessful */ free(ns); - return res; + return result; } string+=2; alloc-=2; } + if(reject_ctrl && (in < 0x20)) { free(ns); return CURLE_URL_MALFORMAT; diff --git a/lib/http_digest.c b/lib/http_digest.c index 50c852405..03963dbc9 100644 --- a/lib/http_digest.c +++ b/lib/http_digest.c @@ -321,16 +321,16 @@ CURLcode Curl_output_digest(struct connectdata *conn, struct SessionHandle *data = conn->data; struct digestdata *d; - CURLcode rc; + CURLcode result; /* The CURL_OUTPUT_DIGEST_CONV macro below is for non-ASCII machines. It converts digest text to ASCII so the MD5 will be correct for what ultimately goes over the network. */ #define CURL_OUTPUT_DIGEST_CONV(a, b) \ - rc = Curl_convert_to_network(a, (char *)b, strlen((const char*)b)); \ - if(rc) { \ + result = Curl_convert_to_network(a, (char *)b, strlen((const char*)b)); \ + if(result) { \ free(b); \ - return rc; \ + return result; \ } if(proxy) { @@ -370,10 +370,12 @@ CURLcode Curl_output_digest(struct connectdata *conn, snprintf(cnoncebuf, sizeof(cnoncebuf), "%08x%08x%08x%08x", Curl_rand(data), Curl_rand(data), Curl_rand(data), Curl_rand(data)); - rc = Curl_base64_encode(data, cnoncebuf, strlen(cnoncebuf), - &cnonce, &cnonce_sz); - if(rc) - return rc; + + result = Curl_base64_encode(data, cnoncebuf, strlen(cnoncebuf), + &cnonce, &cnonce_sz); + if(result) + return result; + d->cnonce = cnonce; } diff --git a/lib/pipeline.c b/lib/pipeline.c index 346f32b55..2645fdb48 100644 --- a/lib/pipeline.c +++ b/lib/pipeline.c @@ -99,11 +99,11 @@ CURLcode Curl_add_handle_to_pipeline(struct SessionHandle *handle, { struct curl_llist_element *sendhead = conn->send_pipe->head; struct curl_llist *pipeline; - CURLcode rc; + CURLcode result; pipeline = conn->send_pipe; - rc = Curl_addHandleToPipeline(handle, pipeline); + result = Curl_addHandleToPipeline(handle, pipeline); if(pipeline == conn->send_pipe && sendhead != conn->send_pipe->head) { /* this is a new one as head, expire it */ @@ -115,7 +115,7 @@ CURLcode Curl_add_handle_to_pipeline(struct SessionHandle *handle, print_pipeline(conn); #endif - return rc; + return result; } /* Move this transfer from the sending list to the receiving list. |