Noncontroversial changes?
Arthur David Olson
olsona at lecserver.nci.nih.gov
Mon Nov 19 18:22:20 UTC 2007
Is there any controversy at all about these changes that were suggested by Ken Pizzini?
(I've changed snippets of the form "a == b ? c : d" to "(a == b) ? c : d" for ease of
reading--or at least for my own ease of reading.)
--ado
diff -ru tzcode2007h-less-P-macro/Makefile tzcode2007-pre-i/Makefile
--- tzcode2007h-less-P-macro/Makefile 2007-08-20 07:47:41.000000000 -0700
+++ tzcode2007-pre-i/Makefile 2007-11-13 15:08:32.930145602 -0800
@@ -86,7 +86,6 @@
LDLIBS=
# Add the following to the end of the "CFLAGS=" line as needed.
-# -Dconst= if `const' does not work (SunOS 4.x cc, OSF1 V5.0 cc)
# -DHAVE_ADJTIME=0 if `adjtime' does not exist (SVR0?)
# -DHAVE_GETTEXT=1 if `gettext' works (GNU, Linux, Solaris); also see LDLIBS
# -DHAVE_INCOMPATIBLE_CTIME_R=1 if your system's time.h declares
diff -ru tzcode2007h-less-P-macro/date.c tzcode2007-pre-i/date.c
--- tzcode2007h-less-P-macro/date.c 2007-11-11 16:56:00.603760665 -0800
+++ tzcode2007-pre-i/date.c 2007-11-13 15:35:01.220657120 -0800
@@ -311,7 +307,7 @@
}
static void
-dogmt()
+dogmt(void)
{
static char ** fakeenv;
diff -ru tzcode2007h-less-P-macro/localtime.c tzcode2007-pre-i/localtime.c
--- tzcode2007h-less-P-macro/localtime.c 2007-11-11 16:56:03.611932091 -0800
+++ tzcode2007-pre-i/localtime.c 2007-11-13 15:44:58.578698614 -0800
@@ -1781,12 +1736,8 @@
** It's okay to guess wrong since the guess
** gets checked.
*/
- /*
- ** The (void *) casts are the benefit of SunOS 3.3 on Sun 2's.
- */
sp = (const struct state *)
- (((void *) funcp == (void *) localsub) ?
- lclptr : gmtptr);
+ ((funcp == localsub) ? lclptr : gmtptr);
#ifdef ALL_STATE
if (sp == NULL)
return WRONG;
@@ -1880,11 +1829,7 @@
** We try to divine the type they started from and adjust to the
** type they need.
*/
- /*
- ** The (void *) casts are the benefit of SunOS 3.3 on Sun 2's.
- */
- sp = (const struct state *) (((void *) funcp == (void *) localsub) ?
- lclptr : gmtptr);
+ sp = (const struct state *) ((funcp == localsub) ? lclptr : gmtptr);
#ifdef ALL_STATE
if (sp == NULL)
return WRONG;
diff -ru tzcode2007h-less-P-macro/logwtmp.c tzcode2007-pre-i/logwtmp.c
--- tzcode2007h-less-P-macro/logwtmp.c 2007-08-20 07:47:42.000000000 -0700
+++ tzcode2007-pre-i/logwtmp.c 2007-11-13 15:08:32.934145830 -0800
@@ -51,8 +51,8 @@
struct utmp ut;
struct stat buf;
int fd;
- time_t time();
- char *strncpy();
+ time_t time(time_t *);
+ char *strncpy(char *, const char *);
if ((fd = open(WTMPFILE, O_WRONLY|O_APPEND, 0)) < 0)
return;
diff -ru tzcode2007h-less-P-macro/private.h tzcode2007-pre-i/private.h
--- tzcode2007h-less-P-macro/private.h 2007-11-11 16:56:05.276026922 -0800
+++ tzcode2007-pre-i/private.h 2007-11-13 15:08:32.934145830 -0800
@@ -109,17 +104,15 @@
#endif /* !defined WEXITSTATUS */
#if HAVE_UNISTD_H
-#include "unistd.h" /* for F_OK and R_OK */
+#include "unistd.h" /* for F_OK, R_OK, and other POSIX goodness */
#endif /* HAVE_UNISTD_H */
-#if !HAVE_UNISTD_H
#ifndef F_OK
#define F_OK 0
#endif /* !defined F_OK */
#ifndef R_OK
#define R_OK 4
#endif /* !defined R_OK */
-#endif /* !HAVE_UNISTD_H */
/* Unlike <ctype.h>'s isdigit, this also works if c < 0 | c > UCHAR_MAX. */
#define is_digit(c) ((unsigned)(c) - '0' <= 9)
@@ -165,69 +158,13 @@
*/
/*
-** SunOS 4.1.1 headers lack EXIT_SUCCESS.
-*/
-
-#ifndef EXIT_SUCCESS
-#define EXIT_SUCCESS 0
-#endif /* !defined EXIT_SUCCESS */
-
-/*
-** SunOS 4.1.1 headers lack EXIT_FAILURE.
-*/
-
-#ifndef EXIT_FAILURE
-#define EXIT_FAILURE 1
-#endif /* !defined EXIT_FAILURE */
-
-/*
-** SunOS 4.1.1 headers lack FILENAME_MAX.
-*/
-
-#ifndef FILENAME_MAX
-
-#ifndef MAXPATHLEN
-#ifdef unix
-#include "sys/param.h"
-#endif /* defined unix */
-#endif /* !defined MAXPATHLEN */
-
-#ifdef MAXPATHLEN
-#define FILENAME_MAX MAXPATHLEN
-#endif /* defined MAXPATHLEN */
-#ifndef MAXPATHLEN
-#define FILENAME_MAX 1024 /* Pure guesswork */
-#endif /* !defined MAXPATHLEN */
-
-#endif /* !defined FILENAME_MAX */
-
-/*
-** SunOS 4.1.1 libraries lack remove.
-*/
-
-#ifndef remove
-extern int unlink(const char * filename);
-#define remove unlink
-#endif /* !defined remove */
-
-/*
-** Some ancient errno.h implementations don't declare errno.
-** But some newer errno.h implementations define it as a macro.
-** Fix the former without affecting the latter.
-*/
-
-#ifndef errno
-extern int errno;
-#endif /* !defined errno */
-
-/*
** Some time.h implementations don't declare asctime_r.
** Others might define it as a macro.
** Fix the former without affecting the latter.
*/
#ifndef asctime_r
-extern char * asctime_r();
+extern char * asctime_r(struct tm const *, char *);
#endif
/*
diff -ru tzcode2007h-less-P-macro/zdump.c tzcode2007-pre-i/zdump.c
--- tzcode2007h-less-P-macro/zdump.c 2007-11-11 16:56:10.112302526 -0800
+++ tzcode2007-pre-i/zdump.c 2007-11-13 15:27:06.301593025 -0800
@@ -88,9 +85,12 @@
#define SECSPERNYEAR (SECSPERDAY * DAYSPERNYEAR)
#define SECSPERLYEAR (SECSPERNYEAR + SECSPERDAY)
+#ifndef HAVE_GETTEXT
+#define HAVE_GETTEXT 0
+#endif
#if HAVE_GETTEXT
#include "locale.h" /* for setlocale */
#include "libintl.h"
#endif /* HAVE_GETTEXT */
#ifndef GNUC_or_lint
@@ -129,10 +129,6 @@
#define TZ_DOMAIN "tz"
#endif /* !defined TZ_DOMAIN */
-#ifndef P
-#define P(x) x
-#endif /* !defined P */
-
extern char ** environ;
extern int getopt(int argc, char * const argv[],
const char * options);
@@ -394,7 +384,7 @@
}
static void
-setabsolutes()
+setabsolutes(void)
{
if (0.5 == (time_t) 0.5) {
/*
@@ -592,7 +578,7 @@
*/
static const char *
-tformat()
+tformat(void)
{
if (0.5 == (time_t) 0.5) { /* floating */
if (sizeof (time_t) > sizeof (double))
More information about the tz
mailing list