Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit eceebb8

Browse files
committed
Jack Jansen: Moved includes to the top, removed think C support
1 parent 40ced50 commit eceebb8

1 file changed

Lines changed: 20 additions & 18 deletions

File tree

Objects/fileobject.c

Lines changed: 20 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,26 @@ PERFORMANCE OF THIS SOFTWARE.
3838
#include <sys/types.h>
3939
#endif /* DONT_HAVE_SYS_TYPES_H */
4040

41+
/* We expect that fstat exists on most systems.
42+
It's confirmed on Unix, Mac and Windows.
43+
If you don't have it, add #define DONT_HAVE_FSTAT to your config.h. */
44+
#ifndef DONT_HAVE_FSTAT
45+
#define HAVE_FSTAT
46+
47+
#ifndef DONT_HAVE_SYS_TYPES_H
48+
#include <sys/types.h>
49+
#endif
50+
51+
#ifndef DONT_HAVE_SYS_STAT_H
52+
#include <sys/stat.h>
53+
#else
54+
#ifdef HAVE_STAT_H
55+
#include <stat.h>
56+
#endif
57+
#endif
58+
59+
#endif /* DONT_HAVE_FSTAT */
60+
4161
#ifdef HAVE_UNISTD_H
4262
#include <unistd.h>
4363
#endif
@@ -54,9 +74,6 @@ PERFORMANCE OF THIS SOFTWARE.
5474
#endif
5575
#endif
5676

57-
#ifdef THINK_C
58-
#define HAVE_FOPENRF
59-
#endif
6077
#ifdef __MWERKS__
6178
/* Mwerks fopen() doesn't always set errno */
6279
#define NO_FOPEN_ERRNO
@@ -445,21 +462,6 @@ file_isatty(f, args)
445462
return PyInt_FromLong(res);
446463
}
447464

448-
/* We expect that fstat exists on most systems.
449-
It's confirmed on Unix, Mac and Windows.
450-
If you don't have it, add #define DONT_HAVE_FSTAT to your config.h. */
451-
#ifndef DONT_HAVE_FSTAT
452-
#define HAVE_FSTAT
453-
454-
#ifndef DONT_HAVE_SYS_TYPES_H
455-
#include <sys/types.h>
456-
#endif
457-
458-
#ifndef DONT_HAVE_SYS_STAT_H
459-
#include <sys/stat.h>
460-
#endif
461-
462-
#endif /* DONT_HAVE_FSTAT */
463465

464466
#if BUFSIZ < 8192
465467
#define SMALLCHUNK 8192

0 commit comments

Comments
 (0)