Issue 9005: Removed dead code.

This commit is contained in:
Alexander Belopolsky 2010-10-13 22:54:34 +00:00
parent a21350976e
commit 59a289d16b
1 changed files with 6 additions and 22 deletions

View File

@ -241,16 +241,10 @@ days_before_year(int year)
int y = year - 1; int y = year - 1;
/* This is incorrect if year <= 0; we really want the floor /* This is incorrect if year <= 0; we really want the floor
* here. But so long as MINYEAR is 1, the smallest year this * here. But so long as MINYEAR is 1, the smallest year this
* can see is 0 (this can happen in some normalization endcases), * can see is 1.
* so we'll just special-case that.
*/ */
assert (year >= 0); assert (year >= 1);
if (y >= 0) return y*365 + y/4 - y/100 + y/400;
return y*365 + y/4 - y/100 + y/400;
else {
assert(y == -1);
return -366;
}
} }
/* Number of days in 4, 100, and 400 year cycles. That these have /* Number of days in 4, 100, and 400 year cycles. That these have
@ -509,20 +503,10 @@ normalize_y_m_d(int *y, int *m, int *d)
{ {
int dim; /* # of days in month */ int dim; /* # of days in month */
/* This gets muddy: the proper range for day can't be determined /* In actual use, m is always the month component extracted from a
* without knowing the correct month and year, but if day is, e.g., * date/datetime object. Therefore it is always in [1, 12] range.
* plus or minus a million, the current month and year values make
* no sense (and may also be out of bounds themselves).
* Saying 12 months == 1 year should be non-controversial.
*/ */
if (*m < 1 || *m > 12) {
--*m;
normalize_pair(y, m, 12);
++*m;
/* |y| can't be bigger than about
* |original y| + |original m|/12 now.
*/
}
assert(1 <= *m && *m <= 12); assert(1 <= *m && *m <= 12);
/* Now only day can be out of bounds (year may also be out of bounds /* Now only day can be out of bounds (year may also be out of bounds