All of lore.kernel.org
 help / color / mirror / Atom feed
From: Jonathan Nieder <jrnieder@gmail.com>
To: Stefan Beller <sbeller@google.com>
Cc: gitster@pobox.com, git@vger.kernel.org,
	Han-Wen Nienhuys <hanwen@google.com>
Subject: Re: [PATCH] sideband: color lines with keyword only
Date: Mon, 3 Dec 2018 15:34:39 -0800	[thread overview]
Message-ID: <20181203233439.GB157301@google.com> (raw)
In-Reply-To: <20181203232353.GA157301@google.com>

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

  reply	other threads:[~2018-12-03 23:34 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-12-03 22:37 [PATCH] sideband: color lines with keyword only Stefan Beller
2018-12-03 23:23 ` Jonathan Nieder
2018-12-03 23:34   ` Jonathan Nieder [this message]
2018-12-03 23:35   ` Stefan Beller
2018-12-03 23:42     ` Jonathan Nieder
2018-12-04  3:16       ` Junio C Hamano
2018-12-10 11:03   ` Han-Wen Nienhuys

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=20181203233439.GB157301@google.com \
    --to=jrnieder@gmail.com \
    --cc=git@vger.kernel.org \
    --cc=gitster@pobox.com \
    --cc=hanwen@google.com \
    --cc=sbeller@google.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.