From 67d2a7b5c502496b0c5acd25a5e0ffa766b61745 Mon Sep 17 00:00:00 2001 From: Jeff King Date: Fri, 5 Apr 2013 18:21:34 -0400 Subject: 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 Signed-off-by: Junio C Hamano --- http.h | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) (limited to 'http.h') diff --git a/http.h b/http.h index 0fe54f4131..fa65128f9e 100644 --- a/http.h +++ b/http.h @@ -136,10 +136,9 @@ extern char *get_remote_object_url(const char *url, const char *hex, int http_get_strbuf(const char *url, struct strbuf *content_type, struct strbuf *result, int options); /* - * Prints an error message using error() containing url and curl_errorstr, - * and returns ret. + * Prints an error message using error() containing url and curl_errorstr. */ -int http_error(const char *url, int ret); +void http_error(const char *url); extern int http_fetch_ref(const char *base, struct ref *ref); -- cgit v1.2.1