From: Patrick Steinhardt <ps@pks.im>
To: Mike Hommey <mh@glandium.org>
Cc: git@vger.kernel.org, gitster@pobox.com
Subject: Re: [PATCH] connect: address -Wsign-compare warnings
Date: Fri, 17 Jan 2025 10:36:13 +0100 [thread overview]
Message-ID: <Z4okjR8YfUGvnt1t@pks.im> (raw)
In-Reply-To: <20250117074909.1430067-1-mh@glandium.org>
On Fri, Jan 17, 2025 at 04:49:09PM +0900, Mike Hommey wrote:
> diff --git a/connect.c b/connect.c
> index 10fad43e98..91f3990014 100644
> --- a/connect.c
> +++ b/connect.c
> @@ -77,7 +76,7 @@ static NORETURN void die_initial_contact(int unexpected)
> /* Checks if the server supports the capability 'c' */
> int server_supports_v2(const char *c)
> {
> - int i;
> + size_t i;
>
> for (i = 0; i < server_capabilities_v2.nr; i++) {
> const char *out;
I know that it's often frowned upon to change formatting while at it.
But in the context of these refactorings I think that it's quite helpful
if you also moved the loop index variable declarations into the loops
themselves. This allows us to trivially see that it's not used anywhere
else.
> @@ -232,12 +231,12 @@ static void annotate_refs_with_symref_info(struct ref *ref)
> string_list_clear(&symref, 0);
> }
>
> -static void process_capabilities(struct packet_reader *reader, int *linelen)
> +static void process_capabilities(struct packet_reader *reader, size_t *linelen)
> {
> const char *feat_val;
> size_t feat_len;
> const char *line = reader->line;
> - int nul_location = strlen(line);
> + size_t nul_location = strlen(line);
> if (nul_location == *linelen)
> return;
> server_capabilities_v1 = xstrdup(line + nul_location + 1);
I think splitting out the strlen(3p)-related changes into a separate
commit might make sense.
Thanks for working on this, quite happy to see that this gets picked up
by the community!
Patrick
next prev parent reply other threads:[~2025-01-17 9:36 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-01-17 7:49 [PATCH] connect: address -Wsign-compare warnings Mike Hommey
2025-01-17 9:36 ` Patrick Steinhardt [this message]
2025-01-17 17:26 ` Junio C Hamano
2025-01-17 21:18 ` Mike Hommey
2025-01-17 21:21 ` Junio C Hamano
2025-01-20 7:58 ` Patrick Steinhardt
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=Z4okjR8YfUGvnt1t@pks.im \
--to=ps@pks.im \
--cc=git@vger.kernel.org \
--cc=gitster@pobox.com \
--cc=mh@glandium.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.