[Python-checkins] cpython: Rename new macros to conform to naming rules (function macros have "Py" prefix,
georg.brandl
python-checkins at python.org
Wed Sep 28 21:48:29 CEST 2011
http://hg.python.org/cpython/rev/dacac31460c0
changeset: 72489:dacac31460c0
user: Georg Brandl <georg at python.org>
date: Wed Sep 28 21:49:49 2011 +0200
summary:
Rename new macros to conform to naming rules (function macros have "Py" prefix, not "PY").
files:
Include/Python.h | 6 +++---
Modules/arraymodule.c | 2 +-
Modules/zipimport.c | 8 ++++----
Objects/unicodeobject.c | 18 +++++++++---------
Python/import.c | 6 +++---
5 files changed, 20 insertions(+), 20 deletions(-)
diff --git a/Include/Python.h b/Include/Python.h
--- a/Include/Python.h
+++ b/Include/Python.h
@@ -160,9 +160,9 @@
#define PyDoc_STR(str) ""
#endif
-#define PY_ARRAY_LENGTH(array) (sizeof(array) / sizeof((array)[0]))
+#define Py_ARRAY_LENGTH(array) (sizeof(array) / sizeof((array)[0]))
-#define PY_MIN(x, y) (((x) > (y)) ? (y) : (x))
-#define PY_MAX(x, y) (((x) > (y)) ? (x) : (y))
+#define Py_MIN(x, y) (((x) > (y)) ? (y) : (x))
+#define Py_MAX(x, y) (((x) > (y)) ? (x) : (y))
#endif /* !Py_PYTHON_H */
diff --git a/Modules/arraymodule.c b/Modules/arraymodule.c
--- a/Modules/arraymodule.c
+++ b/Modules/arraymodule.c
@@ -2810,7 +2810,7 @@
PyInit_array(void)
{
PyObject *m;
- char buffer[PY_ARRAY_LENGTH(descriptors)], *p;
+ char buffer[Py_ARRAY_LENGTH(descriptors)], *p;
PyObject *typecodes;
Py_ssize_t size = 0;
struct arraydescr *descr;
diff --git a/Modules/zipimport.c b/Modules/zipimport.c
--- a/Modules/zipimport.c
+++ b/Modules/zipimport.c
@@ -88,7 +88,7 @@
"archive path too long");
goto error;
}
- if (!PyUnicode_AsUCS4(pathobj, buf, PY_ARRAY_LENGTH(buf), 1))
+ if (!PyUnicode_AsUCS4(pathobj, buf, Py_ARRAY_LENGTH(buf), 1))
goto error;
#ifdef ALTSEP
@@ -473,7 +473,7 @@
PyErr_SetString(ZipImportError, "path too long");
return NULL;
}
- if (!PyUnicode_AsUCS4(pathobj, buf, PY_ARRAY_LENGTH(buf), 1))
+ if (!PyUnicode_AsUCS4(pathobj, buf, Py_ARRAY_LENGTH(buf), 1))
return NULL;
path = buf;
#ifdef ALTSEP
@@ -484,7 +484,7 @@
#endif
len = PyUnicode_GET_LENGTH(self->archive);
if ((size_t)len < Py_UCS4_strlen(path)) {
- if (!PyUnicode_AsUCS4(self->archive, archive, PY_ARRAY_LENGTH(archive), 1))
+ if (!PyUnicode_AsUCS4(self->archive, archive, Py_ARRAY_LENGTH(archive), 1))
return NULL;
if (Py_UCS4_strncmp(path, archive, len) == 0 &&
path[len] == SEP) {
@@ -771,7 +771,7 @@
"Zip path name is too long");
return NULL;
}
- if (!PyUnicode_AsUCS4(archive, path, PY_ARRAY_LENGTH(path), 1))
+ if (!PyUnicode_AsUCS4(archive, path, Py_ARRAY_LENGTH(path), 1))
return NULL;
fp = _Py_fopen(archive, "rb");
diff --git a/Objects/unicodeobject.c b/Objects/unicodeobject.c
--- a/Objects/unicodeobject.c
+++ b/Objects/unicodeobject.c
@@ -1521,7 +1521,7 @@
case 'c':
{
Py_UCS4 ordinal = va_arg(count, int);
- maxchar = PY_MAX(maxchar, ordinal);
+ maxchar = Py_MAX(maxchar, ordinal);
n++;
break;
}
@@ -1617,7 +1617,7 @@
/* since PyUnicode_DecodeUTF8 returns already flexible
unicode objects, there is no need to call ready on them */
argmaxchar = PyUnicode_MAX_CHAR_VALUE(str);
- maxchar = PY_MAX(maxchar, argmaxchar);
+ maxchar = Py_MAX(maxchar, argmaxchar);
n += PyUnicode_GET_LENGTH(str);
/* Remember the str and switch to the next slot */
*callresult++ = str;
@@ -1630,7 +1630,7 @@
if (PyUnicode_READY(obj) == -1)
goto fail;
argmaxchar = PyUnicode_MAX_CHAR_VALUE(obj);
- maxchar = PY_MAX(maxchar, argmaxchar);
+ maxchar = Py_MAX(maxchar, argmaxchar);
n += PyUnicode_GET_LENGTH(obj);
break;
}
@@ -1645,7 +1645,7 @@
if (PyUnicode_READY(obj) == -1)
goto fail;
argmaxchar = PyUnicode_MAX_CHAR_VALUE(obj);
- maxchar = PY_MAX(maxchar, argmaxchar);
+ maxchar = Py_MAX(maxchar, argmaxchar);
n += PyUnicode_GET_LENGTH(obj);
*callresult++ = NULL;
}
@@ -1654,7 +1654,7 @@
if (!str_obj)
goto fail;
argmaxchar = PyUnicode_MAX_CHAR_VALUE(str_obj);
- maxchar = PY_MAX(maxchar, argmaxchar);
+ maxchar = Py_MAX(maxchar, argmaxchar);
n += PyUnicode_GET_LENGTH(str_obj);
*callresult++ = str_obj;
}
@@ -1669,7 +1669,7 @@
if (!str || PyUnicode_READY(str) == -1)
goto fail;
argmaxchar = PyUnicode_MAX_CHAR_VALUE(str);
- maxchar = PY_MAX(maxchar, argmaxchar);
+ maxchar = Py_MAX(maxchar, argmaxchar);
n += PyUnicode_GET_LENGTH(str);
/* Remember the str and switch to the next slot */
*callresult++ = str;
@@ -1684,7 +1684,7 @@
if (!repr || PyUnicode_READY(repr) == -1)
goto fail;
argmaxchar = PyUnicode_MAX_CHAR_VALUE(repr);
- maxchar = PY_MAX(maxchar, argmaxchar);
+ maxchar = Py_MAX(maxchar, argmaxchar);
n += PyUnicode_GET_LENGTH(repr);
/* Remember the repr and switch to the next slot */
*callresult++ = repr;
@@ -1699,7 +1699,7 @@
if (!ascii || PyUnicode_READY(ascii) == -1)
goto fail;
argmaxchar = PyUnicode_MAX_CHAR_VALUE(ascii);
- maxchar = PY_MAX(maxchar, argmaxchar);
+ maxchar = Py_MAX(maxchar, argmaxchar);
n += PyUnicode_GET_LENGTH(ascii);
/* Remember the repr and switch to the next slot */
*callresult++ = ascii;
@@ -11051,7 +11051,7 @@
kind1 = PyUnicode_KIND(str_in);
kind2 = PyUnicode_KIND(sep_obj);
- kind = PY_MAX(kind1, kind2);
+ kind = Py_MAX(kind1, kind2);
buf1 = PyUnicode_DATA(str_in);
if (kind1 != kind)
buf1 = _PyUnicode_AsKind(str_in, kind);
diff --git a/Python/import.c b/Python/import.c
--- a/Python/import.c
+++ b/Python/import.c
@@ -1784,7 +1784,7 @@
return 0;
len = PyUnicode_GET_LENGTH(path_unicode);
- if (!PyUnicode_AsUCS4(path_unicode, buf, PY_ARRAY_LENGTH(buf), 1)) {
+ if (!PyUnicode_AsUCS4(path_unicode, buf, Py_ARRAY_LENGTH(buf), 1)) {
Py_DECREF(path_unicode);
PyErr_Clear();
return 0;
@@ -1828,7 +1828,7 @@
#endif
)
buf[len++] = SEP;
- if (!PyUnicode_AsUCS4(name, buf+len, PY_ARRAY_LENGTH(buf)-len, 1)) {
+ if (!PyUnicode_AsUCS4(name, buf+len, Py_ARRAY_LENGTH(buf)-len, 1)) {
PyErr_Clear();
return 0;
}
@@ -2787,7 +2787,7 @@
if (PyUnicode_READY(parent_name))
return NULL;
buflen = PyUnicode_GET_LENGTH(parent_name);
- if (!PyUnicode_AsUCS4(parent_name, buf, PY_ARRAY_LENGTH(buf), 1)) {
+ if (!PyUnicode_AsUCS4(parent_name, buf, Py_ARRAY_LENGTH(buf), 1)) {
Py_DECREF(parent_name);
PyErr_SetString(PyExc_ValueError,
"Module name too long");
--
Repository URL: http://hg.python.org/cpython
More information about the Python-checkins
mailing list