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

[PATCH v2 1/4] http.c: remove unnecessary casts to long

From
Taylor Blau <me@ttaylorr.com>
Date
Mar 19, 2025, 22:23 UTC
Message-ID
<204e5e18d28951c3cb3c2e70f41873b263b65746.1742423021.git.me@ttaylorr.com>
In-Reply-To
<cover.1742423021.git.me@ttaylorr.com>

When parsing 'http.lowSpeedLimit' and 'http.lowSpeedTime', we explicitly cast the result of 'git_config_int()' to a long before assignment. This cast has been in place since all the way back in 58e60dd203 (Add support for pushing to a remote repository using HTTP/DAV, 2005-11-02).

But that cast has always been unnecessary, since long is guaranteed to be at least as wide as int. Let's drop the cast accordingly.

Noticed-by: Patrick Steinhardt <ps@pks.im>
Signed-off-by: Taylor Blau <me@ttaylorr.com>
---
 http.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/http.c b/http.c
index 0c9a872809..0cbcb079b2 100644
--- a/http.c
+++ b/http.c
@@ -438,11 +438,11 @@ static int http_options(const char *var, const char *value,
 		return 0;
 	}
 	if (!strcmp("http.lowspeedlimit", var)) {
-		curl_low_speed_limit = (long)git_config_int(var, value, ctx->kvi);
+		curl_low_speed_limit = git_config_int(var, value, ctx->kvi);
 		return 0;
 	}
 	if (!strcmp("http.lowspeedtime", var)) {
-		curl_low_speed_time = (long)git_config_int(var, value, ctx->kvi);
+		curl_low_speed_time = git_config_int(var, value, ctx->kvi);
 		return 0;
 	}
 
-- 
2.49.0.4.ge59cf92f8d
Previous: Taylor BlauNext: Taylor Blau
Message 13 of 21 in “http: support fine-tuning curl's keepalive behavior”
  1. 0/3 http: support fine-tuning curl's keepalive behaviorTaylor Blau, Mar 18, 2025
  2. 1/3 http.c: introduce `set_long_from_env()` for convenienceTaylor Blau, Mar 18, 2025
  3. Elijah NewrenMar 19, 2025
  4. Patrick SteinhardtMar 19, 2025
  5. Taylor BlauMar 19, 2025
  6. 2/3 http.c: inline `set_curl_keepalive()`Taylor Blau, Mar 18, 2025
  7. Elijah NewrenMar 19, 2025
  8. 3/3 http.c: allow custom TCP keepalive behavior via configTaylor Blau, Mar 18, 2025
  9. Patrick SteinhardtMar 19, 2025
  10. Elijah NewrenMar 19, 2025
  11. Taylor BlauMar 19, 2025
  12. 0/4 http: support fine-tuning curl's keepalive behaviorTaylor Blau, Mar 19, 2025
  13. 1/4 http.c: remove unnecessary casts to longTaylor Blau, Mar 19, 2025
  14. 2/4 http.c: introduce `set_long_from_env()` for convenienceTaylor Blau, Mar 19, 2025
  15. Patrick SteinhardtMar 20, 2025
  16. Jeff KingApr 1, 2025
  17. 3/4 http.c: inline `set_curl_keepalive()`Taylor Blau, Mar 19, 2025
  18. Jeff KingApr 1, 2025
  19. 4/4 http.c: allow custom TCP keepalive behavior via configTaylor Blau, Mar 19, 2025
  20. Jeff KingApr 1, 2025
  21. Elijah NewrenMar 19, 2025

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.