replace switch cases with the new macro

This commit is contained in:
Viktor Szakats 2026-06-12 16:55:47 +02:00
parent ffb99912ac
commit b0ccea9358
No known key found for this signature in database
2 changed files with 13 additions and 26 deletions

View file

@ -939,30 +939,19 @@ static bool verifyconnect(curl_socket_t sockfd, int *error)
static CURLcode socket_connect_result(struct Curl_easy *data,
const char *ipaddress, int error)
{
switch(error) {
case SOCKEINPROGRESS:
case SOCKEWOULDBLOCK:
#if !defined(USE_WINSOCK) && EAGAIN != SOCKEWOULDBLOCK
/* On some platforms EAGAIN and EWOULDBLOCK are the
* same value, and on others they are different, hence
* the odd #if
*/
case EAGAIN:
#endif
if(SOCK_EWOULDBLOCK_EAGAIN(error) || error == SOCKEINPROGRESS)
return CURLE_OK;
default:
/* unknown error, fallthrough and try another address! */
{
VERBOSE(char buffer[STRERROR_LEN]);
infof(data, "Immediate connect fail for %s: %s", ipaddress,
curlx_strerror(error, buffer, sizeof(buffer)));
NOVERBOSE((void)ipaddress);
}
data->state.os_errno = error;
/* connect failed */
return CURLE_COULDNT_CONNECT;
/* unknown error, fallthrough and try another address! */
{
VERBOSE(char buffer[STRERROR_LEN]);
infof(data, "Immediate connect fail for %s: %s", ipaddress,
curlx_strerror(error, buffer, sizeof(buffer)));
NOVERBOSE((void)ipaddress);
}
data->state.os_errno = error;
/* connect failed */
return CURLE_COULDNT_CONNECT;
}
struct cf_socket_ctx {

View file

@ -165,12 +165,10 @@ static CURLcode do_sendmsg(struct Curl_cfilter *cf,
;
if(!curlx_sztouz(rv, psent)) {
switch(SOCKERRNO) {
case SOCKEWOULDBLOCK:
#if !defined(USE_WINSOCK) && EAGAIN != SOCKEWOULDBLOCK
case EAGAIN:
#endif
int err = SOCKERRNO;
if(SOCK_EWOULDBLOCK_EAGAIN(err))
return CURLE_AGAIN;
switch(err) {
case SOCKEMSGSIZE:
/* UDP datagram is too large; caused by PMTUD. Let it be lost. */
*psent = pktlen;