Jonathan Nieder wrote:
> Stefan Beller wrote:
>> /*
>> * Match case insensitively, so we colorize output from existing
>> @@ -95,7 +95,8 @@ static void maybe_colorize_sideband(struct strbuf *dest,
>> const char *src, int n)
>> * messages. We only highlight the word precisely, so
>> * "successful" stays uncolored.
>> */
>> - if (!strncasecmp(p->keyword, src, len) && !isalnum(src[len])) {
>> + if (!strncasecmp(p->keyword, src, len) &&
>> + (len == n || !isalnum(src[len]))) {
>
> Our custom isalnum treats '\0' as not alphanumeric (sane_ctype[0] ==
> GIT_CNTRL) so this part of the patch is unnecessary. That said, it's
> good for clarity and defensive programming.
Correction: I am being silly here. src[len] can be '\0', '\n', or
'\r' --- it's not always '\0'. And the contract of this function is
that src[len] could be anything. Thanks for having handled it
correctly. :)
Jonathan