Re: [PATCH v4 03/10] xdiff: make xrecord_t.ptr a uint8_t instead of char
- From
Ezekiel Newren <ezekielnewren@gmail.com>
- Date
- Nov 18, 2025, 20:55 UTC
- Message-ID
- <CAH=ZcbDzERvz7ZZ+yFOgEhtoBw3Ym1_2YPL3mbj2p0k7AK0v8w@mail.gmail.com>
- In-Reply-To
- <xmqqy0o7g0rk.fsf@gitster.g>
On Sat, Nov 15, 2025 at 1:26 AM Junio C Hamano <gitster@pobox.com> wrote:
Show 36 quoted lines
>
> "Ezekiel Newren via GitGitGadget" <gitgitgadget@gmail.com> writes:
>
> > In order to avoid a refactor avalanche, many uses of this field were
> > cast to char* or similar. One exception is in get_indent() where the
> > local variable `char c` was changed to `uint8_t c`.
>
> I actually think keeping "char c" as in the original is a lot more
> logical for that particular case, as the existing use of that local
> variable are _all_ about C's 'char', and not about a very short
> unsigned integer. The variable is compared with C's character
> constants like ' ' (whitespace) and '\t' (horizontal tab), or is
> given to XDL_ISSPACE() macro, which is also about C's character.
>
> But because it is so minor a thing, I do not think that it deserves
> a reroll on its own. Just in case if there are other things that
> need to change and the series needs a reroll, here is the only
> change required for this.
>
>
> xdiff/xdiffi.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git c/xdiff/xdiffi.c w/xdiff/xdiffi.c
> index 8eb664be3e..4376f943db 100644
> --- c/xdiff/xdiffi.c
> +++ w/xdiff/xdiffi.c
> @@ -406,7 +406,7 @@ static int get_indent(xrecord_t *rec)
> int ret = 0;
>
> for (size_t i = 0; i < rec->size; i++) {
> - uint8_t c = rec->ptr[i];
> + char c = (char) rec->ptr[i];
>
> if (!XDL_ISSPACE(c))
> return ret;I have v5 ready to go, but there seems to be a problem with gitgitgadget. Once that's resolved I'll post the new version.