From db011864c0710b7be87fb277db23d7b6f8908237 Mon Sep 17 00:00:00 2001 From: cohrs Date: Wed, 24 Sep 2003 02:12:22 +0000 Subject: [PATCH] U651 - avoid declaring errno unnecessarily Some changes for standard C platforms, to avoid declaring errno explictly. Such platforms should declare errno in errno.h, which is already included in the files in question. --- doc/fixes34.3 | 1 + src/files.c | 4 ++++ sys/unix/unixunix.c | 8 ++++---- 3 files changed, 9 insertions(+), 4 deletions(-) diff --git a/doc/fixes34.3 b/doc/fixes34.3 index e3d1ccb6d..0abb94c30 100644 --- a/doc/fixes34.3 +++ b/doc/fixes34.3 @@ -34,6 +34,7 @@ Platform- and/or Interface-Specific Fixes ----------------------------------------- win32tty: fix visible CRLF characters during lockfile error message win32gui: you couldn't specify an alignment in defaults.nh and have it stick +unix: don't define errno if NHSTDC General New Features diff --git a/src/files.c b/src/files.c index 7a4f78c5a..73577f94d 100644 --- a/src/files.c +++ b/src/files.c @@ -20,6 +20,10 @@ # if (_MSC_VER >= 600) # define SKIP_ERRNO # endif +#else +# ifdef NHSTDC +# define SKIP_ERRNO +# endif #endif #ifndef SKIP_ERRNO # ifdef _DCC diff --git a/sys/unix/unixunix.c b/sys/unix/unixunix.c index 80756df61..1e1e10eeb 100644 --- a/sys/unix/unixunix.c +++ b/sys/unix/unixunix.c @@ -22,6 +22,10 @@ extern void NDECL(linux_mapon); extern void NDECL(linux_mapoff); #endif +#ifndef NHSTDC +extern int errno; +#endif + static struct stat buf; /* see whether we should throw away this xlock file */ @@ -41,9 +45,6 @@ int fd; (void) time(&date); #endif if(date - buf.st_mtime < 3L*24L*60L*60L) { /* recent */ -#ifndef NETWORK - extern int errno; -#endif int lockedpid; /* should be the same size as hackpid */ if(read(fd, (genericptr_t)&lockedpid, sizeof(lockedpid)) != @@ -88,7 +89,6 @@ eraseoldlocks() void getlock() { - extern int errno; register int i = 0, fd, c; const char *fq_lock; -- 2.40.0