http: simplify http_error helper function
This helper function should really be a one-liner that prints an error message, but it has ended up unnecessarily complicated: 1. We call error() directly when we fail to start the curl request, so we must later avoid printing a duplicate error in http_error(). It would be much simpler in this case to just stuff the error message into our usual curl_errorstr buffer rather than printing it ourselves. This means that http_error does not even have to care about curl's exit value (the interesting part is in the errorstr buffer already). 2. We return the "ret" value passed in to us, but none of the callers actually cares about our return value. We can just drop this entirely. Signed-off-by: Jeff King <peff@peff.net> Signed-off-by: Junio C Hamano <gitster@pobox.com>
This commit is contained in:

committed by
Junio C Hamano

parent
d5ccbe4dfb
commit
67d2a7b5c5
@ -1551,7 +1551,7 @@ static int remote_exists(const char *path)
|
||||
ret = 0;
|
||||
break;
|
||||
case HTTP_ERROR:
|
||||
http_error(url, HTTP_ERROR);
|
||||
http_error(url);
|
||||
default:
|
||||
ret = -1;
|
||||
}
|
||||
|
Reference in New Issue
Block a user