This is the mail archive of the newlib@sourceware.org mailing list for the newlib project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [PATCH] libc/time/gmtime_r.c, libc/time/lcltime_r.c,, libc/time/local.h, libc/time/mktm_r.c: move localtime related functionality, from _mktm_r() to new _mklocaltm_r() to break dependency of gmtime() on, timezones


On Oct 18 15:42, Freddie Chopin wrote:
> On 10/14/2014 01:16 PM, Corinna Vinschen wrote:
> >Hi Freddie,
> >...
> >With this patch applied, a Coverity scan shows this new problem:
> >
> >   *** CID 74279:  Logically dead code  (DEADCODE)
> >   /newlib/libc/time/gmtime_r.c: 52 in gmtime_r()
> >   46         {
> >   47           rem += SECSPERDAY;
> >   48           --days;
> >   49         }
> >   50       while (rem >= SECSPERDAY)
> >   51         {
> >   >>>     CID 74279:  Logically dead code  (DEADCODE)
> >   >>>     Execution cannot reach this statement: "rem -= 86400L;".
> >   52           rem -= SECSPERDAY;
> >   53           ++days;
> >   54         }
> >   55
> >   56       /* compute hour, min, and sec */
> >   57       res->tm_hour = (int) (rem / SECSPERHOUR);
> >
> >AFAICS, Coverity is right.  The code starts with
> >
> >   rem = ((long)lcltime) % SECSPERDAY;
> >
> >thus lcltime is always < SECSPERDAY.  Is that just an oversight in
> >removing some unused code, or does that point to some other problem,
> >perhaps?
> 
> Small oversight only (; I attach a patch with changelog entry.

Thanks, applied.


Corinna

-- 
Corinna Vinschen
Cygwin Maintainer
Red Hat

Attachment: pgpVkK8U2RdLE.pgp
Description: PGP signature


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]