mirror of
https://github.com/python/cpython.git
synced 2025-07-24 03:35:53 +00:00
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.
This commit is contained in:
parent
1b6185941e
commit
d5fadf75e4
25 changed files with 42 additions and 133 deletions
|
@ -9,10 +9,6 @@
|
|||
|
||||
#include "Python.h"
|
||||
|
||||
#ifdef HAVE_LIMITS_H
|
||||
#include <limits.h>
|
||||
#endif
|
||||
|
||||
|
||||
/* elementary operations on complex numbers */
|
||||
|
||||
|
|
|
@ -4,10 +4,6 @@
|
|||
#include "Python.h"
|
||||
#include "structmember.h"
|
||||
|
||||
#ifdef HAVE_LIMITS_H
|
||||
#include <limits.h>
|
||||
#endif
|
||||
|
||||
#ifndef DONT_HAVE_SYS_TYPES_H
|
||||
#include <sys/types.h>
|
||||
#endif /* DONT_HAVE_SYS_TYPES_H */
|
||||
|
|
|
@ -23,36 +23,6 @@
|
|||
#define CHECK(x) /* Don't know how to check */
|
||||
#endif
|
||||
|
||||
#ifdef HAVE_LIMITS_H
|
||||
#include <limits.h>
|
||||
#endif
|
||||
|
||||
#ifndef LONG_MAX
|
||||
#if SIZEOF_LONG == 4
|
||||
#define LONG_MAX 0X7FFFFFFFL
|
||||
#elif SIZEOF_LONG == 8
|
||||
#define LONG_MAX 0X7FFFFFFFFFFFFFFFL
|
||||
#else
|
||||
#error "could not set LONG_MAX"
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#ifndef LONG_MIN
|
||||
#define LONG_MIN (-LONG_MAX-1)
|
||||
#endif
|
||||
|
||||
#ifdef __NeXT__
|
||||
#ifdef __sparc__
|
||||
/*
|
||||
* This works around a bug in the NS/Sparc 3.3 pre-release
|
||||
* limits.h header file.
|
||||
* 10-Feb-1995 bwarsaw@cnri.reston.va.us
|
||||
*/
|
||||
#undef LONG_MIN
|
||||
#define LONG_MIN (-LONG_MAX-1)
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#if !defined(__STDC__) && !defined(macintosh)
|
||||
extern double fmod(double, double);
|
||||
extern double pow(double, double);
|
||||
|
|
|
@ -4,18 +4,6 @@
|
|||
#include "Python.h"
|
||||
#include <ctype.h>
|
||||
|
||||
#ifdef HAVE_LIMITS_H
|
||||
#include <limits.h>
|
||||
#endif
|
||||
|
||||
#ifndef LONG_MAX
|
||||
#define LONG_MAX 0X7FFFFFFFL
|
||||
#endif
|
||||
|
||||
#ifndef LONG_MIN
|
||||
#define LONG_MIN (-LONG_MAX-1)
|
||||
#endif
|
||||
|
||||
#ifndef CHAR_BIT
|
||||
#define CHAR_BIT 8
|
||||
#endif
|
||||
|
|
|
@ -8,9 +8,6 @@
|
|||
#else
|
||||
#include <sys/types.h> /* For size_t */
|
||||
#endif
|
||||
#ifdef HAVE_LIMITS_H
|
||||
#include <limits.h>
|
||||
#endif
|
||||
|
||||
#define ROUNDUP(n, PyTryBlock) \
|
||||
((((n)+(PyTryBlock)-1)/(PyTryBlock))*(PyTryBlock))
|
||||
|
|
|
@ -2,9 +2,6 @@
|
|||
/* Generic object operations; and implementation of None (NoObject) */
|
||||
|
||||
#include "Python.h"
|
||||
#ifdef HAVE_LIMITS_H
|
||||
#include <limits.h>
|
||||
#endif
|
||||
|
||||
#ifdef macintosh
|
||||
#include "macglue.h"
|
||||
|
|
|
@ -9,13 +9,9 @@
|
|||
int null_strings, one_strings;
|
||||
#endif
|
||||
|
||||
#ifdef HAVE_LIMITS_H
|
||||
#include <limits.h>
|
||||
#else
|
||||
#ifndef UCHAR_MAX
|
||||
#if !defined(HAVE_LIMITS_H) && !defined(UCHAR_MAX)
|
||||
#define UCHAR_MAX 255
|
||||
#endif
|
||||
#endif
|
||||
|
||||
static PyStringObject *characters[UCHAR_MAX + 1];
|
||||
#ifndef DONT_SHARE_SHORT_STRINGS
|
||||
|
|
|
@ -67,12 +67,6 @@ Copyright (c) Corporation for National Research Initiatives.
|
|||
#include "unicodeobject.h"
|
||||
#include "ucnhash.h"
|
||||
|
||||
#if defined(HAVE_LIMITS_H)
|
||||
#include <limits.h>
|
||||
#else
|
||||
#define INT_MAX 2147483647
|
||||
#endif
|
||||
|
||||
#ifdef MS_WIN32
|
||||
#include <windows.h>
|
||||
#endif
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue