proposed changes to eliminate P macro

Ken Pizzini "tz." at explicate.org
Mon Nov 12 01:55:55 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
      . "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")

I was going to also remove all "register" delcarations, on the premise
that modern compilers do well without the hints, but decided the patch
became too unwieldy to review that way (it's already rather large, which
is why I decided to attach a gzipped version instead of placing the
patch in-line).  I did drop "register" delcarations on any lines that I
touched for other reasons though.


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: 12043 bytes
Desc: not available
Url : http://mm.icann.org/pipermail/tz/attachments/20071111/56a298f9/tz-cleanup.patch-0001.gz 


More information about the tz mailing list