Re: [PATCH 5/5] http: don't hardcode the value of CURL_SOCKOPT_OK
- From
Junio C Hamano <gitster@pobox.com>
- Date
- Sep 9, 2021, 23:15 UTC
- Message-ID
- <xmqqr1dxwdbu.fsf@gitster.g>
- In-Reply-To
- <patch-5.5-4f42c0e48b0-20210908T152807Z-avarab@gmail.com>
Ævar Arnfjörð Bjarmason <avarab@gmail.com> writes:
Show 21 quoted lines
> +/**
> + * CURL_SOCKOPT_OK was added in 7.21.5, released in April 2011.
> + */
> +#ifndef CURL_SOCKOPT_OK
> +#define CURL_SOCKOPT_OK 0
> +#endif
> +
> /**
> * CURLOPT_TCP_KEEPALIVE was added in 7.25.0, released in March 2012.
> */
> diff --git a/http.c b/http.c
> index e38fcc34d64..c40439d39ce 100644
> --- a/http.c
> +++ b/http.c
> @@ -533,7 +533,7 @@ static int sockopt_callback(void *client, curl_socket_t fd, curlsocktype type)
> if (rc < 0)
> warning_errno("unable to set SO_KEEPALIVE on socket");
>
> - return 0; /* CURL_SOCKOPT_OK only exists since curl 7.21.5 */
> + return CURL_SOCKOPT_OK;
> }This is much better than the one in the previous round where an extra CPP macro with GIT_CURL_SOCKOPT_OK_AVAILABLE or some other name was used to conditionally return 0 or CURL_SOCKOPT_OK.