summaryrefslogtreecommitdiffstats
path: root/Modules
diff options
context:
space:
mode:
authorBrett Cannon <brett@python.org>2013-06-04 21:36:07 (GMT)
committerBrett Cannon <brett@python.org>2013-06-04 21:36:07 (GMT)
commitc97ec8fa6978657bfb8069db4128f785b29ea0aa (patch)
tree46aa19c3d8f30869ec71ad17a39bc4275b5c4cf6 /Modules
parentaf38f5a5032e49d527adcb9c594abfeba5d9b9b2 (diff)
parent640c35ce135d71c6aafa13bb5985150f680416cc (diff)
downloadcpython-c97ec8fa6978657bfb8069db4128f785b29ea0aa.zip
cpython-c97ec8fa6978657bfb8069db4128f785b29ea0aa.tar.gz
cpython-c97ec8fa6978657bfb8069db4128f785b29ea0aa.tar.bz2
merge
Diffstat (limited to 'Modules')
-rw-r--r--Modules/_bz2module.c12
-rw-r--r--Modules/_cursesmodule.c14
-rw-r--r--Modules/_multiprocessing/multiprocessing.h9
-rw-r--r--Modules/md5module.c6
-rw-r--r--Modules/sha1module.c6
-rw-r--r--Modules/socketmodule.c7
6 files changed, 14 insertions, 40 deletions
diff --git a/Modules/_bz2module.c b/Modules/_bz2module.c
index 4eee5a2..2a9ad69 100644
--- a/Modules/_bz2module.c
+++ b/Modules/_bz2module.c
@@ -36,8 +36,6 @@
#define RELEASE_LOCK(obj)
#endif
-#define MIN(X, Y) (((X) < (Y)) ? (X) : (Y))
-
typedef struct {
PyObject_HEAD
@@ -157,7 +155,7 @@ compress(BZ2Compressor *c, char *data, size_t len, int action)
/* On a 64-bit system, len might not fit in avail_in (an unsigned int).
Do compression in chunks of no more than UINT_MAX bytes each. */
if (c->bzs.avail_in == 0 && len > 0) {
- c->bzs.avail_in = MIN(len, UINT_MAX);
+ c->bzs.avail_in = Py_MIN(len, UINT_MAX);
len -= c->bzs.avail_in;
}
@@ -173,7 +171,7 @@ compress(BZ2Compressor *c, char *data, size_t len, int action)
c->bzs.next_out = PyBytes_AS_STRING(result) + data_size;
buffer_left = PyBytes_GET_SIZE(result) - data_size;
}
- c->bzs.avail_out = MIN(buffer_left, UINT_MAX);
+ c->bzs.avail_out = Py_MIN(buffer_left, UINT_MAX);
}
Py_BEGIN_ALLOW_THREADS
@@ -370,7 +368,7 @@ decompress(BZ2Decompressor *d, char *data, size_t len)
d->bzs.next_in = data;
/* On a 64-bit system, len might not fit in avail_in (an unsigned int).
Do decompression in chunks of no more than UINT_MAX bytes each. */
- d->bzs.avail_in = MIN(len, UINT_MAX);
+ d->bzs.avail_in = Py_MIN(len, UINT_MAX);
len -= d->bzs.avail_in;
d->bzs.next_out = PyBytes_AS_STRING(result);
d->bzs.avail_out = PyBytes_GET_SIZE(result);
@@ -399,7 +397,7 @@ decompress(BZ2Decompressor *d, char *data, size_t len)
if (d->bzs.avail_in == 0) {
if (len == 0)
break;
- d->bzs.avail_in = MIN(len, UINT_MAX);
+ d->bzs.avail_in = Py_MIN(len, UINT_MAX);
len -= d->bzs.avail_in;
}
if (d->bzs.avail_out == 0) {
@@ -410,7 +408,7 @@ decompress(BZ2Decompressor *d, char *data, size_t len)
d->bzs.next_out = PyBytes_AS_STRING(result) + data_size;
buffer_left = PyBytes_GET_SIZE(result) - data_size;
}
- d->bzs.avail_out = MIN(buffer_left, UINT_MAX);
+ d->bzs.avail_out = Py_MIN(buffer_left, UINT_MAX);
}
}
if (data_size != PyBytes_GET_SIZE(result))
diff --git a/Modules/_cursesmodule.c b/Modules/_cursesmodule.c
index 132670d..dff1a17 100644
--- a/Modules/_cursesmodule.c
+++ b/Modules/_cursesmodule.c
@@ -168,10 +168,6 @@ static char *screen_encoding = NULL;
"must call start_color() first"); \
return 0; }
-#ifndef MIN
-#define MIN(x,y) ((x) < (y) ? (x) : (y))
-#endif
-
/* Utility Functions */
/*
@@ -1212,7 +1208,7 @@ PyCursesWindow_GetStr(PyCursesWindowObject *self, PyObject *args)
if (!PyArg_ParseTuple(args,"i;n", &n))
return NULL;
Py_BEGIN_ALLOW_THREADS
- rtn2 = wgetnstr(self->win,rtn,MIN(n, 1023));
+ rtn2 = wgetnstr(self->win, rtn, Py_MIN(n, 1023));
Py_END_ALLOW_THREADS
break;
case 2:
@@ -1232,11 +1228,11 @@ PyCursesWindow_GetStr(PyCursesWindowObject *self, PyObject *args)
#ifdef STRICT_SYSV_CURSES
Py_BEGIN_ALLOW_THREADS
rtn2 = wmove(self->win,y,x)==ERR ? ERR :
- wgetnstr(self->win, rtn, MIN(n, 1023));
+ wgetnstr(self->win, rtn, Py_MIN(n, 1023));
Py_END_ALLOW_THREADS
#else
Py_BEGIN_ALLOW_THREADS
- rtn2 = mvwgetnstr(self->win, y, x, rtn, MIN(n, 1023));
+ rtn2 = mvwgetnstr(self->win, y, x, rtn, Py_MIN(n, 1023));
Py_END_ALLOW_THREADS
#endif
break;
@@ -1374,7 +1370,7 @@ PyCursesWindow_InStr(PyCursesWindowObject *self, PyObject *args)
case 1:
if (!PyArg_ParseTuple(args,"i;n", &n))
return NULL;
- rtn2 = winnstr(self->win,rtn,MIN(n,1023));
+ rtn2 = winnstr(self->win, rtn, Py_MIN(n, 1023));
break;
case 2:
if (!PyArg_ParseTuple(args,"ii;y,x",&y,&x))
@@ -1384,7 +1380,7 @@ PyCursesWindow_InStr(PyCursesWindowObject *self, PyObject *args)
case 3:
if (!PyArg_ParseTuple(args, "iii;y,x,n", &y, &x, &n))
return NULL;
- rtn2 = mvwinnstr(self->win, y, x, rtn, MIN(n,1023));
+ rtn2 = mvwinnstr(self->win, y, x, rtn, Py_MIN(n,1023));
break;
default:
PyErr_SetString(PyExc_TypeError, "instr requires 0 or 3 arguments");
diff --git a/Modules/_multiprocessing/multiprocessing.h b/Modules/_multiprocessing/multiprocessing.h
index 0759a80..68a5984 100644
--- a/Modules/_multiprocessing/multiprocessing.h
+++ b/Modules/_multiprocessing/multiprocessing.h
@@ -99,13 +99,4 @@ PyObject *_PyMp_SetError(PyObject *Type, int num);
extern PyTypeObject _PyMp_SemLockType;
-/*
- * Miscellaneous
- */
-
-#ifndef MIN
-# define MIN(x, y) ((x) < (y) ? x : y)
-# define MAX(x, y) ((x) > (y) ? x : y)
-#endif
-
#endif /* MULTIPROCESSING_H */
diff --git a/Modules/md5module.c b/Modules/md5module.c
index 6e15a20..7dc38ea 100644
--- a/Modules/md5module.c
+++ b/Modules/md5module.c
@@ -91,10 +91,6 @@ typedef struct {
(y)[3] = (unsigned char)(((x)>>24)&255); (y)[2] = (unsigned char)(((x)>>16)&255); \
(y)[1] = (unsigned char)(((x)>>8)&255); (y)[0] = (unsigned char)((x)&255); }
-#ifndef MIN
- #define MIN(x, y) ( ((x)<(y))?(x):(y) )
-#endif
-
/* MD5 macros */
@@ -244,7 +240,7 @@ md5_process(struct md5_state *md5, const unsigned char *in, Py_ssize_t inlen)
in += MD5_BLOCKSIZE;
inlen -= MD5_BLOCKSIZE;
} else {
- n = MIN(inlen, (Py_ssize_t)(MD5_BLOCKSIZE - md5->curlen));
+ n = Py_MIN(inlen, (Py_ssize_t)(MD5_BLOCKSIZE - md5->curlen));
memcpy(md5->buf + md5->curlen, in, (size_t)n);
md5->curlen += (MD5_INT32)n;
in += n;
diff --git a/Modules/sha1module.c b/Modules/sha1module.c
index d39f192..824024c 100644
--- a/Modules/sha1module.c
+++ b/Modules/sha1module.c
@@ -92,10 +92,6 @@ typedef struct {
(y)[4] = (unsigned char)(((x)>>24)&255); (y)[5] = (unsigned char)(((x)>>16)&255); \
(y)[6] = (unsigned char)(((x)>>8)&255); (y)[7] = (unsigned char)((x)&255); }
-#ifndef MIN
- #define MIN(x, y) ( ((x)<(y))?(x):(y) )
-#endif
-
/* SHA1 macros */
@@ -220,7 +216,7 @@ sha1_process(struct sha1_state *sha1,
in += SHA1_BLOCKSIZE;
inlen -= SHA1_BLOCKSIZE;
} else {
- n = MIN(inlen, (Py_ssize_t)(SHA1_BLOCKSIZE - sha1->curlen));
+ n = Py_MIN(inlen, (Py_ssize_t)(SHA1_BLOCKSIZE - sha1->curlen));
memcpy(sha1->buf + sha1->curlen, in, (size_t)n);
sha1->curlen += (SHA1_INT32)n;
in += n;
diff --git a/Modules/socketmodule.c b/Modules/socketmodule.c
index efbde3a..f1e310d 100644
--- a/Modules/socketmodule.c
+++ b/Modules/socketmodule.c
@@ -95,9 +95,6 @@ Local naming conventions:
#include "Python.h"
#include "structmember.h"
-#undef MAX
-#define MAX(x, y) ((x) < (y) ? (y) : (x))
-
/* Socket object documentation */
PyDoc_STRVAR(sock_doc,
"socket([family[, type[, proto]]]) -> socket object\n\
@@ -4819,7 +4816,7 @@ socket_inet_pton(PyObject *self, PyObject *args)
char* ip;
int retval;
#ifdef ENABLE_IPV6
- char packed[MAX(sizeof(struct in_addr), sizeof(struct in6_addr))];
+ char packed[Py_MAX(sizeof(struct in_addr), sizeof(struct in6_addr))];
#else
char packed[sizeof(struct in_addr)];
#endif
@@ -4870,7 +4867,7 @@ socket_inet_ntop(PyObject *self, PyObject *args)
int len;
const char* retval;
#ifdef ENABLE_IPV6
- char ip[MAX(INET_ADDRSTRLEN, INET6_ADDRSTRLEN) + 1];
+ char ip[Py_MAX(INET_ADDRSTRLEN, INET6_ADDRSTRLEN) + 1];
#else
char ip[INET_ADDRSTRLEN + 1];
#endif