proposed changes to eliminate P macro
Ken Pizzini
tz_ at explicate.org
Wed Nov 14 00:36:34 UTC 2007
On Thu, Nov 08, 2007 at 09:26:29AM -0500, Arthur David Olson wrote:
> Here are proposed changes to eliminate the "P" macro from time zone source
> (a first step in simplifying the code by assuming C99 compilers).
A good start. I'm continuing that process with the attached patch:
* the main changes, comprising the bulk of this patch, is the addition
of prototypes for functions which were _not_ handled by the "P" macro;
this includes explicit (void) parameter lists where appropriate
* use angle brackets <> instead of double-quotes for system #include-s,
for the benefit of any compiler that handles those more efficiently
(e.g., support of pre-compiled system headers)
* removes some conditionals that were only needed to support pre-C89
compilers (like "cc" on SunOS 4.x and older); this includes:
. removal if isascii() definition and calls
. removal of private strerror() definition
. removal of "%02.2d"-style printf formats (favoring "%.2d" instead)
. removal of (void*) casts on function-pointer comparisons
. removal of "failsafe" declarations of symbols that C89 dictates
must be defined in relevant headers; viz: EXIT_SUCCESS, EXIT_FAILURE,
FILENAME_MAX, errno
* some small tweaks for type-correctness:
. removed a spurious cast from scheck.c
. removed a spurious/erroneous cast from zic.c:doabbr()
(might have been useful at one time, before function prototypes
were used, but now ought to be a (size_t) instead of a (unsigned)
if it is going to be an explilcit cast)
. made "wp" in zic.c:newabbr() a "const", and added new "xp"
variable to handle the case where "wp" was treated as non-const
("wp" is assigned literal string values, so it should be "const")
Because the patch is rather large, I've decided to attach a gzipped
version instead of placing the patch in-line.
On the meta-level, regarding the goal of this code clean-up project:
I'd personally prefer to allow compilers that are C89 compliant
(provided that some sort of 64-bit integer is supported) to work
with this code, if possible, rather than requiring full C99 support.
--Ken Pizzini
-------------- next part --------------
A non-text attachment was scrubbed...
Name: tz-cleanup.patch.gz
Type: application/octet-stream
Size: 11941 bytes
Desc: not available
URL: <http://mm.icann.org/pipermail/tz/attachments/20071113/30e16e13/attachment.obj>
More information about the tz
mailing list