]> granicus.if.org Git - python/commitdiff
Move distributed and duplicated config for stat() and fstat() into pyport.h.
authorTim Peters <tim.peters@gmail.com>
Thu, 18 Jan 2001 03:03:16 +0000 (03:03 +0000)
committerTim Peters <tim.peters@gmail.com>
Thu, 18 Jan 2001 03:03:16 +0000 (03:03 +0000)
Include/pyport.h
Objects/fileobject.c
Python/getmtime.c
Python/import.c

index bf79012d1bd8f6be9b7455758fe481dbff3ae0eb..852efb894fabf82aa703dac9a4fb2829afcca300 100644 (file)
@@ -118,6 +118,38 @@ typedef unsigned LONG_LONG Py_uintptr_t;
 
 #endif /* !HAVE_SYS_SELECT_H */
 
+/*******************************
+ * stat() and fstat() fiddling *
+ *******************************/
+
+/* We expect that stat and fstat exist on most systems.
+ *  It's confirmed on Unix, Mac and Windows.
+ *  If you don't have them, add
+ *      #define DONT_HAVE_STAT
+ * and/or
+ *      #define DONT_HAVE_FSTAT
+ * to your config.h. Python code beyond this should check HAVE_STAT and
+ * HAVE_FSTAT instead.
+ * Also
+ *      #define DONT_HAVE_SYS_STAT_H
+ * if <sys/stat.h> doesn't exist on your platform, and
+ *      #define HAVE_STAT_H
+ * if <stat.h> does (don't look at me -- ths mess is inherited).
+ */
+#ifndef DONT_HAVE_STAT
+#define HAVE_STAT
+#endif
+
+#ifndef DONT_HAVE_FSTAT
+#define HAVE_FSTAT
+#endif
+
+#ifndef DONT_HAVE_SYS_STAT_H
+#include <sys/stat.h>
+#elif defined(HAVE_STAT_H)
+#include <stat.h>
+#endif
+
 
 #ifdef __cplusplus
 /* Move this down here since some C++ #include's don't like to be included
@@ -192,7 +224,7 @@ extern int gethostname(char *, int);
 #ifdef __BEOS__
 /* Unchecked */
 /* It's in the libs, but not the headers... - [cjh] */
-int shutdown( int, int ); 
+int shutdown( int, int );
 #endif
 
 #ifdef HAVE__GETPTY
@@ -305,7 +337,7 @@ extern double hypot(double, double);
 #define sqrt sqrtd
 #define tan tand
 #define tanh tanhd
-#endif 
+#endif
 
 
 /************************************
index 385d1881ffb1404822919c64cce9757b6e6f2c0d..7d3287928abb6bb829f520126d5bfe6d4ea9d90f 100644 (file)
@@ -8,26 +8,6 @@
 #include <sys/types.h>
 #endif /* DONT_HAVE_SYS_TYPES_H */
 
-/* We expect that fstat exists on most systems.
-   It's confirmed on Unix, Mac and Windows.
-   If you don't have it, add #define DONT_HAVE_FSTAT to your config.h. */
-#ifndef DONT_HAVE_FSTAT
-#define HAVE_FSTAT
-
-#ifndef DONT_HAVE_SYS_TYPES_H
-#include <sys/types.h>
-#endif
-
-#ifndef DONT_HAVE_SYS_STAT_H
-#include <sys/stat.h>
-#else
-#ifdef HAVE_STAT_H
-#include <stat.h>
-#endif
-#endif
-
-#endif /* DONT_HAVE_FSTAT */
-
 #ifdef HAVE_UNISTD_H
 #include <unistd.h>
 #endif
index 4c7ecd68a2fb5f1d9328f89430f68bc0cea9569c..c77782df67ba6729387ee5ef21b229c0a6591308 100644 (file)
@@ -6,16 +6,6 @@
 #include "Python.h"
 #include "config.h"
 
-#include <stdio.h>
-#ifndef DONT_HAVE_SYS_TYPES_H
-#include <sys/types.h>
-#endif
-#ifndef DONT_HAVE_SYS_STAT_H
-#include <sys/stat.h>
-#elif defined(HAVE_STAT_H)
-#include <stat.h>
-#endif
-
 time_t
 PyOS_GetLastModificationTime(char *path, FILE *fp)
 {
index a97d0c66ece829dd4b33d2c0c1179e8749bec8f4..da4015f72fda8149968557f0c7cc98f5252c1e81 100644 (file)
 #include <unistd.h>
 #endif
 
-/* We expect that stat exists on most systems.
-   It's confirmed on Unix, Mac and Windows.
-   If you don't have it, add #define DONT_HAVE_STAT to your config.h. */
-#ifndef DONT_HAVE_STAT
-#define HAVE_STAT
-
-#ifndef DONT_HAVE_SYS_TYPES_H
-#include <sys/types.h>
-#endif
-
-#ifndef DONT_HAVE_SYS_STAT_H
-#include <sys/stat.h>
-#elif defined(HAVE_STAT_H)
-#include <stat.h>
-#endif
-
 #ifdef HAVE_FCNTL_H
 #include <fcntl.h>
 #endif
@@ -48,9 +32,6 @@
 #define S_ISDIR(mode) (((mode) & S_IFMT) == S_IFDIR)
 #endif
 
-#endif
-
-
 extern time_t PyOS_GetLastModificationTime(char *, FILE *);
                                                /* In getmtime.c */