git/list[1] front-page[2] threads[3] people[4] search[5] about
 

[PATCH 3/6] remote-curl: rename shadowed options variable

From
Jeff King <peff@peff.net>
Date
Dec 1, 2016, 09:04 UTC
Message-ID
<20161201090422.wzyquf4swsv33ti6@sigill.intra.peff.net>
In-Reply-To
<20161201090336.xjbb47bublfcpglo@sigill.intra.peff.net>

The discover_refs() function has a local "options" variable to hold the http_get_options we pass to http_get_strbuf(). But this shadows the global "struct options" that holds our program-level options, which cannot be accessed from this function.

Let's give the local one a more descriptive name so we can tell the two apart.

Signed-off-by: Jeff King <peff@peff.net>
---
 remote-curl.c | 18 +++++++++---------
 1 file changed, 9 insertions(+), 9 deletions(-)
diff --git a/remote-curl.c b/remote-curl.c
index f14c41f4c..f4145fd5c 100644
--- a/remote-curl.c
+++ b/remote-curl.c
@@ -274,7 +274,7 @@ static struct discovery *discover_refs(const char *service, int for_push)
 	struct strbuf effective_url = STRBUF_INIT;
 	struct discovery *last = last_discovery;
 	int http_ret, maybe_smart = 0;
-	struct http_get_options options;
+	struct http_get_options http_options;
 
 	if (last && !strcmp(service, last->service))
 		return last;
@@ -291,15 +291,15 @@ static struct discovery *discover_refs(const char *service, int for_push)
 		strbuf_addf(&refs_url, "service=%s", service);
 	}
 
-	memset(&options, 0, sizeof(options));
-	options.content_type = &type;
-	options.charset = &charset;
-	options.effective_url = &effective_url;
-	options.base_url = &url;
-	options.no_cache = 1;
-	options.keep_error = 1;
+	memset(&http_options, 0, sizeof(http_options));
+	http_options.content_type = &type;
+	http_options.charset = &charset;
+	http_options.effective_url = &effective_url;
+	http_options.base_url = &url;
+	http_options.no_cache = 1;
+	http_options.keep_error = 1;
 
-	http_ret = http_get_strbuf(refs_url.buf, &buffer, &options);
+	http_ret = http_get_strbuf(refs_url.buf, &buffer, &http_options);
 	switch (http_ret) {
 	case HTTP_OK:
 		break;
-- 
2.11.0.319.g1f4e1e0
Previous: Jeff KingNext: Jeff King
Message 2 of 18 in “restricting http redirects”
  1. 0/6 restricting http redirectsJeff King, Dec 1, 2016
  2. 3/6 remote-curl: rename shadowed options variableJeff King, Dec 1, 2016
  3. 1/6 http: simplify update_url_from_redirectJeff King, Dec 1, 2016
  4. 2/6 http: always update the base URL for redirectsJeff King, Dec 1, 2016
  5. Ramsay JonesDec 1, 2016
  6. Brandon WilliamsDec 1, 2016
  7. Philip OakleyDec 1, 2016
  8. Junio C HamanoDec 1, 2016
  9. Ramsay JonesDec 2, 2016
  10. Jeff KingDec 2, 2016
  11. Ramsay JonesDec 2, 2016
  12. 6/6 http-walker: complain about non-404 loose object errorsJeff King, Dec 1, 2016
  13. 4/6 http: make redirects more obviousJeff King, Dec 1, 2016
  14. Ramsay JonesDec 1, 2016
  15. 5/6 http: treat http-alternates like redirectsJeff King, Dec 1, 2016
  16. Brandon WilliamsDec 1, 2016
  17. Jeff KingDec 2, 2016
  18. Jeff KingDec 5, 2016

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.