summaryrefslogtreecommitdiffstats
path: root/Modules
diff options
context:
space:
mode:
authorFred Drake <fdrake@acm.org>2000-09-26 05:46:01 (GMT)
committerFred Drake <fdrake@acm.org>2000-09-26 05:46:01 (GMT)
commitd5fadf75e4d18df61db41205ace0cda28d98eeaa (patch)
tree1b82c40e9bacf707cc8411fb9f0b6816c6f857d4 /Modules
parent1b6185941ee5ccbfb7bb79ef2fcd55e279ade902 (diff)
downloadcpython-d5fadf75e4d18df61db41205ace0cda28d98eeaa.zip
cpython-d5fadf75e4d18df61db41205ace0cda28d98eeaa.tar.gz
cpython-d5fadf75e4d18df61db41205ace0cda28d98eeaa.tar.bz2
Rationalize use of limits.h, moving the inclusion to Python.h.
Add definitions of INT_MAX and LONG_MAX to pyport.h. Remove includes of limits.h and conditional definitions of INT_MAX and LONG_MAX elsewhere. This closes SourceForge patch #101659 and bug #115323.
Diffstat (limited to 'Modules')
-rw-r--r--Modules/_localemodule.c1
-rw-r--r--Modules/_sre.c6
-rw-r--r--Modules/arraymodule.c3
-rw-r--r--Modules/md5.h17
-rw-r--r--Modules/selectmodule.c3
-rw-r--r--Modules/stropmodule.c6
-rw-r--r--Modules/structmodule.c1
7 files changed, 5 insertions, 32 deletions
diff --git a/Modules/_localemodule.c b/Modules/_localemodule.c
index 2588b8e..80bfbb2 100644
--- a/Modules/_localemodule.c
+++ b/Modules/_localemodule.c
@@ -15,7 +15,6 @@ This software comes with no warranty. Use at your own risk.
#include <errno.h>
#include <locale.h>
#include <string.h>
-#include <limits.h>
#include <ctype.h>
#if defined(MS_WIN32)
diff --git a/Modules/_sre.c b/Modules/_sre.c
index cf4982d..2412d42 100644
--- a/Modules/_sre.c
+++ b/Modules/_sre.c
@@ -40,12 +40,6 @@ char copyright[] = " SRE 0.9.8 Copyright (c) 1997-2000 by Secret Labs AB ";
#include "sre.h"
-#if defined(HAVE_LIMITS_H)
-#include <limits.h>
-#else
-#define INT_MAX 2147483647
-#endif
-
#include <ctype.h>
/* name of this module, minus the leading underscore */
diff --git a/Modules/arraymodule.c b/Modules/arraymodule.c
index 991fdc2..ad7bcc2 100644
--- a/Modules/arraymodule.c
+++ b/Modules/arraymodule.c
@@ -12,9 +12,6 @@
#include <sys/types.h> /* For size_t */
#endif /* DONT_HAVE_SYS_TYPES_H */
#endif /* !STDC_HEADERS */
-#ifdef HAVE_LIMITS_H
-#include <limits.h>
-#endif /* HAVE_LIMITS_H */
struct arrayobject; /* Forward */
diff --git a/Modules/md5.h b/Modules/md5.h
index 12b3aa3..e169f77 100644
--- a/Modules/md5.h
+++ b/Modules/md5.h
@@ -33,21 +33,14 @@ typedef unsigned char *POINTER;
/* UINT2 defines a two byte word */
typedef unsigned short int UINT2;
-#ifdef HAVE_LIMITS_H
-#include <limits.h>
-#else
-/* Wild guess */
-#define LONG_MAX 2147483647L
-#endif
-
/* UINT4 defines a four byte word */
-#if defined(INT_MAX) && INT_MAX == 2147483647
-typedef unsigned int UINT4;
-#else
-#if defined(LONG_MAX) && LONG_MAX == 2147483647L
+#if SIZEOF_LONG == 4
typedef unsigned long int UINT4;
+#else
+#if INT_MAX == 2147483647
+typedef unsigned int UINT4;
#endif
-/* Too bad if neither is */
+/* Too bad if neither is; pyport.h would need to be fixed. */
#endif
/* ========== End global.h; continue md5.h ========== */
diff --git a/Modules/selectmodule.c b/Modules/selectmodule.c
index 55c3a49..114ac35 100644
--- a/Modules/selectmodule.c
+++ b/Modules/selectmodule.c
@@ -12,9 +12,6 @@
#ifdef HAVE_UNISTD_H
#include <unistd.h>
#endif
-#ifdef HAVE_LIMITS_H
-#include <limits.h>
-#endif
#ifdef HAVE_POLL_H
#include <poll.h>
#endif
diff --git a/Modules/stropmodule.c b/Modules/stropmodule.c
index b8f7519..203feb9 100644
--- a/Modules/stropmodule.c
+++ b/Modules/stropmodule.c
@@ -9,12 +9,6 @@ this module directly.";
#include "Python.h"
-#ifdef HAVE_LIMITS_H
-#include <limits.h>
-#else
-#define INT_MAX 2147483647
-#endif
-
#include <ctype.h>
/* XXX This file assumes that the <ctype.h> is*() functions
XXX are defined for all 8-bit characters! */
diff --git a/Modules/structmodule.c b/Modules/structmodule.c
index 4d60122..a28ca54 100644
--- a/Modules/structmodule.c
+++ b/Modules/structmodule.c
@@ -31,7 +31,6 @@ The variable struct.error is an exception raised on errors.";
#include "Python.h"
-#include <limits.h>
#include <ctype.h>