From: Patrick Steinhardt <ps@pks.im>
To: Elia Pinto <gitter.spiros@gmail.com>
Cc: git@vger.kernel.org,
Johannes Schindelin <Johannes.Schindelin@gmx.de>,
Jeff King <peff@peff.net>, Junio C Hamano <gitster@pobox.com>,
Shuqi Liang <cheskaqiqi@gmail.com>,
Karthik Nayak <karthik.188@gmail.com>,
Toon Claes <toon@iotcl.com>
Subject: Re: [PATCH 3/3] convert: use size_t for buffer sizes
Date: Wed, 21 Oct 2026 13:24:43 +0200 [thread overview]
Message-ID: <atig-5kJzKHZS4jj@pks.im> (raw)
In-Reply-To: <20261021101640.329990-4-gitter.spiros@gmail.com>
On Wed, Oct 21, 2026 at 12:16:39PM +0200, Elia Pinto wrote:
> diff --git a/convert.c b/convert.c
> index 036506842c..ca5594cab0 100644
> --- a/convert.c
> +++ b/convert.c
> @@ -42,9 +42,9 @@ struct text_stat {
> unsigned printable, nonprintable;
> };
>
> -static void gather_stats(const char *buf, unsigned long size, struct text_stat *stats)
> +static void gather_stats(const char *buf, size_t size, struct text_stat *stats)
> {
> - unsigned long i;
> + size_t i;
>
> memset(stats, 0, sizeof(*stats));
>
One thing to note here is that `struct text_stat` still uses `unsigned`
counters. Is this something we should fix, as well?
> @@ -1077,7 +1077,7 @@ static int read_convert_config(const char *var, const char *value,
> return 0;
> }
>
> -static int count_ident(const char *cp, unsigned long size)
> +static int count_ident(const char *cp, size_t size)
> {
> /*
> * "$Id: 0000000000000000000000000000000000000000 $" <=> "$Id$"
This function is counting `$Id$` markers, so it's rather unlikely that
it ever overflows. Theoretically it's possible though.
Patrick
next prev parent reply other threads:[~2026-10-21 11:24 UTC|newest]
Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-10-21 10:16 [PATCH 0/3] use size_t for a few more object and buffer sizes Elia Pinto
2026-10-21 10:16 ` [PATCH 1/3] odb: use size_t for the length of objects to write Elia Pinto
2026-10-21 11:24 ` Patrick Steinhardt
2026-10-21 10:16 ` [PATCH 2/3] diff: use size_t for the allocation size of word-diff buffers Elia Pinto
2026-10-21 11:24 ` Patrick Steinhardt
2026-10-21 10:16 ` [PATCH 3/3] convert: use size_t for buffer sizes Elia Pinto
2026-10-21 11:24 ` Patrick Steinhardt [this message]
2026-10-30 9:58 ` [PATCH v2 0/4] use size_t for a few more object and " Elia Pinto
2026-10-30 9:58 ` [PATCH v2 1/4] odb: use size_t for the length of objects to write Elia Pinto
2026-10-30 11:44 ` Patrick Steinhardt
2026-10-30 9:58 ` [PATCH v2 2/4] diff: use size_t for the allocation size of word-diff buffers Elia Pinto
2026-10-30 9:58 ` [PATCH v2 3/4] convert: use size_t for buffer sizes Elia Pinto
2026-10-30 9:58 ` [PATCH v2 4/4] convert: use size_t for text statistics and ident counts Elia Pinto
2026-10-30 11:44 ` 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=atig-5kJzKHZS4jj@pks.im \
--to=ps@pks.im \
--cc=Johannes.Schindelin@gmx.de \
--cc=cheskaqiqi@gmail.com \
--cc=git@vger.kernel.org \
--cc=gitster@pobox.com \
--cc=gitter.spiros@gmail.com \
--cc=karthik.188@gmail.com \
--cc=peff@peff.net \
--cc=toon@iotcl.com \
/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.