[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
Freddie Chopin
freddie_chopin@op.pl
Sat Oct 18 13:42:00 GMT 2014
- Previous message (by thread): [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
- Next message (by thread): [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
- Messages sorted by:
[ date ]
[ thread ]
[ subject ]
[ author ]
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.
Regards,
FCh
-------------- next part --------------
2014-10-18 Freddie Chopin <freddie_chopin@op.pl>
* libc/time/gmtime_r.c (gmtime_r): remove dead code
-------------- next part --------------
A non-text attachment was scrubbed...
Name: libc-time-gmtimerc-gmtimer-remove-dead-code.patch
Type: text/x-patch
Size: 402 bytes
Desc: not available
URL: <http://sourceware.org/pipermail/newlib/attachments/20141018/8c8df225/attachment.bin>
- Previous message (by thread): [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
- Next message (by thread): [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
- Messages sorted by:
[ date ]
[ thread ]
[ subject ]
[ author ]
More information about the Newlib
mailing list