code cleanup: We prefer 'CURLcode result'
This commit is contained in:
parent
b790bdf46b
commit
085081fc6e
@ -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;
|
||||
}
|
||||
|
||||
/*
|
||||
|
15
lib/escape.c
15
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;
|
||||
|
@ -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;
|
||||
}
|
||||
|
||||
|
@ -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.
|
||||
|
Loading…
Reference in New Issue
Block a user