1
0
mirror of https://frontier.innolan.net/rainlance/amiga-tz.git synced 2026-05-07 00:33:51 +00:00
Commit Graph

36 Commits

Author SHA1 Message Date
Paul Eggert
f0133dd86a Port to NetBSD, where, e.g., 'time_t' is wider than 'long'.
I audited the code and fixed as many width-asssumptions as I could
find, including several places where the code assumed that 'time_t'
was no wider than 'long'; this assumption is not true on 32-bit
NetBSD platforms.  This caught every problem that is already fixed
in the NetBSD zic.c, and caught quite a few more.
* Makefile: Add comments re HAVE_DOS_FILE_NAMES and HAVE_INTTYPES_H.
* date.c (checkfinal, netsettime): Don't use 'long' where 'int' will do.
* difftime.c (difftime): Mark with ATTRIBUTE_CONST.
Use uintmax_t, not unsigned long, for the widest unsigned integer type.
Use long double, not double, if time_t is wider than uintmax_t;
this can in theory help on nonstandard platforms, such as GCC
with 64-bit uintmax_t and 128-bit __int128_t.
* localtime.c (struct ttinfo.tt_gmtoff, struct rule.r_time)
(detzcode, getsecs, getoffset, gmtsub, localsub, increment_overflow32)
(normalize_overflow32, time1, time2, timesub, transtime, tzparse)
(time2sub, timeoff, gtime):
* tzfile.h (SECSPERDAY):
* zdump.c (SECSPERDAY):
* zic.c (convert, puttzcode):
Use int_fast32_t, not long, when all we care is that values up to
2**31 can be stored.  This doesn't fix any bugs, but it allows
more opportunity for compiler optimization.
(struct lsinfo.ls_corr, timesub, leapcorr):
Use int_fast64_t, not long, when values up to 2**63 can be stored.
(timesub): Make it clearer when we are truncating 0.5 to 0.
(increment_overflow32): Rename from long_increment_overflow.
All uses changed.
(normalize_overflow32): Rename from long_normalize_overflow.
All uses changed.
* private.h (HAVE_INTTYPES_H, ATTRIBUTE_CONST): New macros.
Include <inttypes.h> if HAVE_INTTYPES_H.
(INT_FAST64_MIN, INT_FAST64_MAX, SCNdFAST64, int_fast32_t, PRIdMAX)
(uintmax_t, PRIuMAX, _Noreturn):
Define to reasonable values if it's an older compiler.
* scheck.c (scheck): Add support for arbitrary formats, such as
those that SCNdFAST64 can expand to, at the price of no longer
supporting weird conversion specs like "%[%]".
* strftime.c (_fmt): Use intmax_t and uintmax_t to format time_t,
not long and unsigned long.
* zdump.c (int_fast32_t, intmax_t, PRIdMAX, SCNdMAX):
Define for pre-C99 compilers, like private.h does.
(delta, yeartot, main): Use intmax_t, not long.
(hunt): Use time_t, not long, since the diff must be nonnegative.
(tformat): Allow for time_t wider than long.
* zic.c (ZIC_MIN, ZIC_MAX, SCNdZIC): New macros.
(OFFSET_STRLEN_MAXIMUM, RULE_STRLEN_MAXIMUM): Remove.
(struct rule): Make r_loyear, r_hiyear, r_tod, r_stdoff, z_gmtoff,
z_stdoff zic_t, not long.
(addtype, gethms, oadd, rpytime, tadd, gmtoffs, corr, inleap)
(stringoffset, stringrule, outzone, addtype, adjleap, rpytime)
(LDAYSPERWEEK):
Use zic_t, not long.
(leapminyear, leapmaxyear, min_year, max_year, rulesub, updateminmax)
(outzone, rpytime):
Use zic_t, not int.
(usage): Now _Noreturn.
(main): Use S_IWGRP, not 'unix', to determine whether to call umask.
(writezone): Omit unnecessary cast.
(mkdirs): Use HAVE_DOS_FILE_NAMES, not 'unix', to determine
whether to parse DOS file anmes.
(eitol): Remove; no longer needed.
2013-05-27 21:26:18 -07:00
Paul Eggert
2151ca6b20 Restore 'register'.
* asctime.c (asctime_r, asctime):
* date.c (main, dogmt, reset, nondigit, sametm, convert, checkfinal):
* ialloc.c (icatalloc):
* localtime.c (detzcode, detzcode64, settzname, tzload)
(typesequiv, getzname, getqzname, getnum, getsecs, getoffset)
(getrule, transtime, tzparse, tzset, localsub, gmtsub)
(leaps_thru_end_of, timesub, increment_overflow)
(long_increment_overflow, normalize_overflow)
(long_normalize_overflow, tmcomp, time2sub, time1, leapcorr):
* scheck.c (scheck):
* strftime.c (_yconv):
* zdump.c (my_localtime, abbrok, main, yeartot, hunt)
(delta, show, abbr, dumptime):
* zic.c (main, dolink, itsdir, associate, infile, inrule)
(inzone, inzcont, inzsub, inleap, inlink, rulesub, convert64)
(writezone, doabbr, stringoffset, stringrule, stringzone)
(outzone, addtype, leapadd, adjleap, ciequal, itsabbr, byword)
(getfields, rpytime, newabbr, mkdirs):
Restore the uses of 'register', reverting that part of the
"More C modernization" patch.  See Arthur David Olson in
<http://mm.icann.org/pipermail/tz/2012-October/018385.html>.
2012-10-26 17:37:42 -07:00
Paul Eggert
c350bfd55f More C modernization.
* Makefile (typecheck): Add -D__time_t_defined to CFLAGS,
for glibc 2.15.
* asctime.c (asctime_r, asctime):
* date.c (main, dogmt, reset, nondigit, sametm, convert, checkfinal):
* ialloc.c (icatalloc):
* localtime.c (detzcode, detzcode64, settzname, tzload)
(typesequiv, getzname, getqzname, getnum, getsecs, getoffset)
(getrule, transtime, tzparse, tzset, localsub, gmtsub)
(leaps_thru_end_of, timesub, increment_overflow)
(long_increment_overflow, normalize_overflow)
(long_normalize_overflow, tmcomp, time2sub, time1, leapcorr):
* scheck.c (scheck):
* strftime.c (_yconv):
* zdump.c (my_localtime, abbrok, main, yeartot, hunt)
(delta, show, abbr, dumptime):
* zic.c (main, dolink, itsdir, associate, infile, inrule)
(inzone, inzcont, inzsub, inleap, inlink, rulesub, convert64)
(writezone, doabbr, stringoffset, stringrule, stringzone)
(outzone, addtype, leapadd, adjleap, ciequal, itsabbr, byword)
(getfields, rpytime, newabbr, mkdirs):
Omit 'register', as it adds no value these days.  See Christos Zoulas in
<http://mm.icann.org/pipermail/tz/2012-October/018376.html>.
* date.c (netsettime) [TSP_SETDATE]: Add forward decl.
Don't rely on implicit int.  Now static.  Use NULL, not 0.
* zdump.c: Include "limits.h".
(absolute_min_time, absolute_max_time): Compute at compile-time,
as the run-time tests relied on undefined behavior.
(checkabsolutes): Rename from setabsolutes.  Just check, since
there's nothing to set now.  All uses changed.
2012-10-26 00:48:01 -07:00
Paul Eggert
400ecf36bb Assume C89.
* Makefile (GCC_DEBUG_FLAGS): Modernize for GCC 4.6.3 x86.
* asctime.c (asctime_r, asctime):
* date.c (main, dogmt, reset, wildinput, nondigit, oops, display)
(timeout, sametm, netsettime):
* difftime.c (difftime):
* ialloc.c (icatalloc, icpyalloc):
* localtime.c (detzcode, detzcode64, differ_by_repeat)
(tzload, typesequiv, getzname, getnum, getsecs, getoffset)
(getrule, transtime, tzparse, gmtload, tzsetwall, tzset)
(localsub, localtime, localtime_r, gmtsub, gmtime, gmtime_r)
(offtime, leaps_thru_end_of, timesub, ctime, ctime_r)
(increment_overflow, long_increment_overflow)
(normalize_overflow, long_normalize_overflow, tmcomp, time2sub)
(time2, time1, mktime, timelocal, timegm, timeoff, gtime)
(leapcorr, time2posix, posix2time):
* scheck.c (scheck):
* strftime.c (strftime, _fmt, _conv, _add, _yconv, _loc):
* zdump.c (my_localtime, abbrok, usage, main, yeartot)
(delta, abbr, dumptime):
* zic.c (memcheck, eats, eat, error, warning, main)
(dolink, itsdir, rcomp, associate, infile, gethms, inrule)
(inzone, inzcont, inzsub, inleap, inlink, rulesub, convert)
(convert64, puttzcode, puttzcode64, atcomp, is32, writezone, DO)
(doabbr, updateminmax, stringoffset, stringrule, stringzone)
(outzone, addtt, addtype, leapadd, yearistype, lowerit, ciequal)
(itsabbr, byword, getfields, oadd, tadd, rpytime, newabbr)
(mkdirs, eitol):
Assume C89 or better.  Mostly this consists of using function
prototypes.  In a few places, prototypes are required for
portability to hosts where time_t does not promote to itself and
where a preceding prototype does not override a definition.  But
while we're at it we might as well be consistent: it's safe to
assume at-least-C89 these days.
* ialloc.c (nonzero, imalloc, icalloc, irealloc, ifree, icfree):
Remove; no longer needed now that we assume C89 or better.
All callers changed to use malloc, calloc, realloc, free.
* localtime.c (getzname, getqzname, leaps_thru_end_of, transtime):
* zdump.c (delta, yeartot):
* zic.c (eitol):
Now pure.
* private.h, zdump.c (ATTRIBUTE_PURE): New macro.
* private.h (icalloc, imalloc, irealloc, icfree, ifree): Remove decls.
* zic.c: Remove no-longer-necessary forward decls.
(max_time, min_time): Now const.
(setboundaries): Remove.
2012-10-12 07:53:12 -07:00
Paul Eggert
dccd5a16af Switch from SCCS to git.
Remove the SCCS keyword '%W%' from all files.
Mostly this just remove comments.
Remove trailing white space, too.
* Makefile (TZCODE_VERSION): New macro.
(version.h): New rule.
(tzselect): Interpolate TZCODE_VERSION.
(clean): Remove version.h.
(zdump.o, zic.o): Depend on version.h.
* asctime.c, date.c, difftime.c, ialloc.c, localtime.c, scheck.c:
* strftime.c, zdump.c, zic.c: Remove elsieid.
* private.h: Remove privatehid.
* tzfile.h: Remove tzfilehid.
* tzselect.h (TZCODE_VERSION): Rename from VERSION.
* zdump.c, zic.c: Include "version.h",
and use TZCODE_VERSION instead of elsieid.
2012-07-18 17:30:38 -07:00
Arthur David Olson
a98c7060a3 disclaimers
SCCS-file: scheck.c
SCCS-SID: 8.19
2012-07-18 03:02:58 -04:00
Arthur David Olson
82d85c8478 McGrath scheck mods
SCCS-file: scheck.c
SCCS-SID: 8.17
2012-07-18 03:02:52 -04:00
Arthur David Olson
3aed48c5bf delinted
SCCS-file: scheck.c
SCCS-SID: 8.16
2012-07-18 03:02:47 -04:00
Arthur David Olson
9a1a292f8f format parameter can be const
SCCS-file: scheck.c
SCCS-SID: 8.15
2012-07-18 03:02:27 -04:00
Arthur David Olson
4607aab43a Eggert mods
SCCS-file: scheck.c
SCCS-SID: 8.14
2012-07-18 03:02:26 -04:00
Arthur David Olson
1ae81b7895 eggert mods
SCCS-file: scheck.c
SCCS-SID: 8.13
2012-07-18 03:02:20 -04:00
Arthur David Olson
5be995995c delinting
SCCS-file: scheck.c
SCCS-SID: 8.12
2012-07-18 03:02:14 -04:00
Arthur David Olson
0b72ba9205 delinted
SCCS-file: scheck.c
SCCS-SID: 8.11
2012-07-18 03:02:09 -04:00
Arthur David Olson
a5e405f8fb headers redone; delinted
SCCS-file: scheck.c
SCCS-SID: 8.10
2012-07-18 03:01:57 -04:00
Arthur David Olson
a4a44dc22f const work
SCCS-file: scheck.c
SCCS-SID: 8.9
2012-07-18 03:01:52 -04:00
Arthur David Olson
28e1a2d2a8 standardized and delinted
SCCS-file: scheck.c
SCCS-SID: 8.8
2012-07-18 03:01:48 -04:00
Arthur David Olson
000583cc0f nonstd.h
SCCS-file: scheck.c
SCCS-SID: 8.7
2012-07-18 03:01:47 -04:00
Arthur David Olson
b795ee9192 standardization
SCCS-file: scheck.c
SCCS-SID: 8.6
2012-07-18 03:01:47 -04:00
Arthur David Olson
bad69829dc minix work
SCCS-file: scheck.c
SCCS-SID: 8.5
2012-07-18 03:01:47 -04:00
Arthur David Olson
2032d5832b delinted
SCCS-file: scheck.c
SCCS-SID: 8.4
2012-07-18 03:01:47 -04:00
Arthur David Olson
0b45a6c81f updates for TZ distribution
SCCS-file: scheck.c
SCCS-SID: 8.3
2012-07-18 03:01:47 -04:00
Arthur David Olson
bfd2856e98 STDC/TURBOC work
SCCS-file: scheck.c
SCCS-SID: 8.2
2012-07-18 03:01:46 -04:00
Arthur David Olson
e1cad1642b cyntax fix
SCCS-file: scheck.c
SCCS-SID: 7.15
2012-07-18 03:01:42 -04:00
Arthur David Olson
ca17d363c6 bug fix
SCCS-file: scheck.c
SCCS-SID: 7.14
2012-07-18 03:01:41 -04:00
Arthur David Olson
e5a64303fe use imalloc
SCCS-file: scheck.c
SCCS-SID: 7.13
2012-07-18 03:01:41 -04:00
Arthur David Olson
8f752fd403 OBJECTID -> !NOID
SCCS-file: scheck.c
SCCS-SID: 7.12
2012-07-18 03:01:41 -04:00
Arthur David Olson
aa21c187bb conservatism
SCCS-file: scheck.c
SCCS-SID: 7.10
2012-07-18 03:01:40 -04:00
Arthur David Olson
2a56ff8452 minor mods
SCCS-file: scheck.c
SCCS-SID: 7.9
2012-07-18 03:01:36 -04:00
Arthur David Olson
2fede59c6b minor optimization
SCCS-file: scheck.c
SCCS-SID: 7.8
2012-07-18 03:01:36 -04:00
Arthur David Olson
c50c9940b3 indentation; MAL NULL
SCCS-file: scheck.c
SCCS-SID: 7.7
2012-07-18 03:01:36 -04:00
Arthur David Olson
ef3e352a39 more versatile
SCCS-file: scheck.c
SCCS-SID: 7.6
2012-07-18 03:01:34 -04:00
Arthur David Olson
86766b3778 tz work
SCCS-file: scheck.c
SCCS-SID: 7.5
2012-07-18 03:01:34 -04:00
Arthur David Olson
cb2769ddac minor optimization
SCCS-file: scheck.c
SCCS-SID: 7.4
2012-07-18 03:01:34 -04:00
Arthur David Olson
9764dd3513 malloc declared
SCCS-file: scheck.c
SCCS-SID: 7.3
2012-07-18 03:01:34 -04:00
Arthur David Olson
d34b21535a first version
SCCS-file: scheck.c
SCCS-SID: 7.2
2012-07-18 03:01:34 -04:00
Arthur David Olson
1ef307410d created
SCCS-file: scheck.c
SCCS-SID: 7.1
2012-07-18 03:01:34 -04:00