diff options
author | Patrick Steinhardt <ps@pks.im> | 2024-12-06 11:27:24 +0100 |
---|---|---|
committer | Junio C Hamano <gitster@pobox.com> | 2024-12-06 12:20:04 +0100 |
commit | 80c9e70ebe871f0826bc101142c66ff783405100 (patch) | |
tree | c95f04cef2dc0abb2d1fe8e4470e9e385e637b12 /version.c | |
parent | pkt-line: fix -Wsign-compare warning on 32 bit platform (diff) | |
download | git-80c9e70ebe871f0826bc101142c66ff783405100.tar.xz git-80c9e70ebe871f0826bc101142c66ff783405100.zip |
global: trivial conversions to fix `-Wsign-compare` warnings
We have a bunch of loops which iterate up to an unsigned boundary using
a signed index, which generates warnigs because we compare a signed and
unsigned value in the loop condition. Address these sites for trivial
cases and enable `-Wsign-compare` warnings for these code units.
This patch only adapts those code units where we can drop the
`DISABLE_SIGN_COMPARE_WARNINGS` macro in the same step.
Signed-off-by: Patrick Steinhardt <ps@pks.im>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'version.c')
-rw-r--r-- | version.c | 4 |
1 files changed, 1 insertions, 3 deletions
@@ -1,4 +1,3 @@ -#define DISABLE_SIGN_COMPARE_WARNINGS #include "git-compat-util.h" #include "version.h" #include "strbuf.h" @@ -25,11 +24,10 @@ const char *git_user_agent_sanitized(void) if (!agent) { struct strbuf buf = STRBUF_INIT; - int i; strbuf_addstr(&buf, git_user_agent()); strbuf_trim(&buf); - for (i = 0; i < buf.len; i++) { + for (size_t i = 0; i < buf.len; i++) { if (buf.buf[i] <= 32 || buf.buf[i] >= 127) buf.buf[i] = '.'; } |