mirror of
https://github.com/xen-project/xen.git
synced 2026-10-28 02:01:24 +01:00
time: drop dead code from gmtime()
"days", as calculated, can't be negative. Drop the respective loop and change its type. Similarly "rem" can't be negative and doesn't require more than 32 bits. Change its type, too. As a consequence, the tm_wday calculation also can't yield negative values, so the respective conditional can be dropped as well. Signed-off-by: Jan Beulich <jbeulich@suse.com> Acked-by: Andrew Cooper <andrew.cooper3@citrix.com>
This commit is contained in:
1 parent
10d417b8b6
commit
4909438bc3
1 file changed
+2
-8
+2
-8
@@ -45,7 +45,8 @@ static DEFINE_SPINLOCK(wc_lock);
|
||||
struct tm gmtime(unsigned long t)
|
||||
{
|
||||
struct tm tbuf;
|
||||
long days, rem;
|
||||
unsigned long days;
|
||||
unsigned int rem;
|
||||
int y;
|
||||
const unsigned short int *ip;
|
||||
|
||||
@@ -70,18 +71,11 @@ struct tm gmtime(unsigned long t)
|
||||
tbuf.tm_sec = rem % 60;
|
||||
/* January 1, 1970 was a Thursday. */
|
||||
tbuf.tm_wday = (4 + days) % 7;
|
||||
if ( tbuf.tm_wday < 0 )
|
||||
tbuf.tm_wday += 7;
|
||||
while ( days >= (rem = __isleap(y) ? 366 : 365) )
|
||||
{
|
||||
++y;
|
||||
days -= rem;
|
||||
}
|
||||
while ( days < 0 )
|
||||
{
|
||||
--y;
|
||||
days += __isleap(y) ? 366 : 365;
|
||||
}
|
||||
tbuf.tm_year = y - 1900;
|
||||
tbuf.tm_yday = days;
|
||||
/* SAF-14-safe use boolean as an array index */
|
||||
|
||||