]> granicus.if.org Git - nethack/commitdiff
U651 - avoid declaring errno unnecessarily
authorcohrs <cohrs>
Wed, 24 Sep 2003 02:12:22 +0000 (02:12 +0000)
committercohrs <cohrs>
Wed, 24 Sep 2003 02:12:22 +0000 (02:12 +0000)
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
src/files.c
sys/unix/unixunix.c

index e3d1ccb6d00ff0cf1f76e7b040c4cf4769200106..0abb94c30c70eb97440b4be13181173d88b86dc3 100644 (file)
@@ -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
index 7a4f78c5a32ceb9ab9ec557a7fc32c490b1aff65..73577f94d87798708f5ff8c698ebda33fd1b85b8 100644 (file)
 # if (_MSC_VER >= 600)
 #  define SKIP_ERRNO
 # endif
+#else
+# ifdef NHSTDC
+#  define SKIP_ERRNO
+# endif
 #endif
 #ifndef SKIP_ERRNO
 # ifdef _DCC
index 80756df616c1ff93c57870681b22f7f8650b5f61..1e1e10eeba6c49bf7bc09ad8ad0445e68fea926b 100644 (file)
@@ -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;