[prev in list] [next in list] [prev in thread] [next in thread]
List: util-linux-ng
Subject: Re: [PATCH 03/11] cal: clean up use of constants
From: Sami Kerola <kerolasa () iki ! fi>
Date: 2013-04-29 21:05:16
Message-ID: CAG27Bk0hvt2h28u0KWtqKXKJJgMr_WX3TpebuwY6Gh_0qLTKfA () mail ! gmail ! com
[Download RAW message or body]
On 29 April 2013 16:51, Thomas Bächler <thomas@archlinux.org> wrote:
> Am 28.04.2013 19:10, schrieb Sami Kerola:
>> +#define FIRST_WEEKDAY SATURDAY /* Jan 1st, 1 was a Saturday */
>> +#define REFORMATION_WEEKDAY TUESDAY /* after reformation it was Thursday */
>
> The constant says Tuesday, the comment says Thursday. You should maybe
> double-check the rest of the constants, too.
Thanks Thomas, good catch... although probably not quite what you expected.
I started to wondering why test suite did not catch this. After gazing
code for moment I decided recompile with coverage turned on. Results
were very clear. Not a once the REFORMATION_WEEKDAY was returned. That
puzzled me for some while, until I realized the September 1752 are
never evaluated with day_in_week(), the day_array() is short cutting
that evaluation by setting the short month with memcpy().
From the original patch REFORMATION_WEEKDAY is removed, and where that
value was returned there is now abort(). Additionally I think the
day_in_week() can be simplified, which I will do as a separated
change.
--
Sami Kerola
http://www.iki.fi/kerolasa/
--
To unsubscribe from this list: send the line "unsubscribe util-linux" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic