[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
src/data/calendar.c
From: |
John Darrington |
Subject: |
src/data/calendar.c |
Date: |
Mon, 27 Mar 2006 10:58:03 +0800 |
User-agent: |
Mutt/1.5.9i |
I've been doing some coverage analysis to see what our test suite does
and doesn't exercise.
In src/data/calendar.c
/* Takes a count of days from 14 Oct 1582 and returns the
corresponding weekday 1...7, with 1=Sunday. */
int
calendar_offset_to_wday (int ofs)
{
int wday = (ofs - EPOCH + 1) % 7 + 1;
if (wday <= 0)
wday += 7;
return wday;
}
Can the the condition in the above IF statement ever be true? So far
as I can tell, only if the ofs < (EPOCH - 1) but dates before EPOCH
are not permitted.
So shouldn't the "if (wday <=0) ... ;" be replaced with
"assert(wday>0);" ?
J'
--
PGP Public key ID: 1024D/2DE827B3
fingerprint = 8797 A26D 0854 2EAB 0285 A290 8A67 719C 2DE8 27B3
See http://pgp.mit.edu or any PGP keyserver for public key.
signature.asc
Description: Digital signature
- src/data/calendar.c,
John Darrington <=