Subject: Re: [PATCH v4 03/10] xdiff: make xrecord_t.ptr a uint8_t instead of char

From: Junio C Hamano <[email-masked]>
Date: Sat, 15 Nov 2025 00:26:07 -0800

"Ezekiel Newren via GitGitGadget" <[email-masked]> 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;