From: Junio C Hamano <gitster@pobox.com>
To: Timo Hirvonen <tihirvon@gmail.com>
Cc: "Chris Larson" <clarson@kergoth.com>, git@vger.kernel.org
Subject: Re: [PATCH] Fix parsing numeric color values
Date: Wed, 06 Feb 2008 01:59:26 -0800 [thread overview]
Message-ID: <7vzluez9q9.fsf@gitster.siamese.dyndns.org> (raw)
In-Reply-To: <20080205211821.e4a15194.tihirvon@gmail.com> (Timo Hirvonen's message of "Tue, 5 Feb 2008 21:18:21 +0200")
Timo Hirvonen <tihirvon@gmail.com> writes:
> Fix bug reported by Chris Larson <clarson@kergoth.com>. Numeric color
> only worked if it was at end of line.
Signoff?
It is much easier to read if you said that backwards:
Numeric color only worked if it was at end of line.
Noticed by Chris Larson <clarson@kergoth.com>.
> @@ -17,7 +17,7 @@ static int parse_color(const char *name, int len)
> return i - 1;
> }
> i = strtol(name, &end, 10);
> - if (*name && !*end && i >= -1 && i <= 255)
> + if (*name && (!*end || isspace(*end)) && i >= -1 && i <= 255)
Hmph. Is it the same as (end-name) == len?
Please add a test so that your fix won't be broken by others who
might later touch this code.
next prev parent reply other threads:[~2008-02-06 10:00 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2008-02-05 17:34 [PATCH] Fix bug in parse_color that prevented the user from changing the background colors Chris Larson
2008-02-05 18:39 ` Timo Hirvonen
[not found] ` <b6ebd0a50802051045t4949df68u7e405ea618403a31@mail.gmail.com>
2008-02-05 18:48 ` Chris Larson
2008-02-05 18:58 ` Timo Hirvonen
2008-02-05 19:18 ` [PATCH] Fix parsing numeric color values Timo Hirvonen
2008-02-06 9:59 ` Junio C Hamano [this message]
2008-02-06 12:16 ` [PATCH v2] " Timo Hirvonen
2008-02-06 12:16 ` [PATCH] Add tests for diff/status color parser Timo Hirvonen
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=7vzluez9q9.fsf@gitster.siamese.dyndns.org \
--to=gitster@pobox.com \
--cc=clarson@kergoth.com \
--cc=git@vger.kernel.org \
--cc=tihirvon@gmail.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).