mirror of https://github.com/python/cpython
Rename new macros to conform to naming rules (function macros have "Py" prefix, not "PY").
This commit is contained in:
parent
5ce1b0dbc0
commit
4cb0de246c
|
@ -160,9 +160,9 @@ PyAPI_FUNC(PyObject*) _Py_Mangle(PyObject *p, PyObject *name);
|
|||
#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 */
|
||||
|
|
|
@ -2810,7 +2810,7 @@ PyMODINIT_FUNC
|
|||
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;
|
||||
|
|
|
@ -88,7 +88,7 @@ zipimporter_init(ZipImporter *self, PyObject *args, PyObject *kwds)
|
|||
"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 @@ zipimporter_get_data(PyObject *obj, PyObject *args)
|
|||
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 @@ zipimporter_get_data(PyObject *obj, PyObject *args)
|
|||
#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 @@ read_directory(PyObject *archive)
|
|||
"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");
|
||||
|
|
|
@ -1521,7 +1521,7 @@ PyUnicode_FromFormatV(const char *format, va_list vargs)
|
|||
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 @@ PyUnicode_FromFormatV(const char *format, va_list vargs)
|
|||
/* 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 @@ PyUnicode_FromFormatV(const char *format, va_list vargs)
|
|||
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 @@ PyUnicode_FromFormatV(const char *format, va_list vargs)
|
|||
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 @@ PyUnicode_FromFormatV(const char *format, va_list vargs)
|
|||
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 @@ PyUnicode_FromFormatV(const char *format, va_list vargs)
|
|||
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 @@ PyUnicode_FromFormatV(const char *format, va_list vargs)
|
|||
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 @@ PyUnicode_FromFormatV(const char *format, va_list vargs)
|
|||
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 @@ PyUnicode_RPartition(PyObject *str_in, PyObject *sep_in)
|
|||
|
||||
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);
|
||||
|
|
|
@ -1784,7 +1784,7 @@ find_module_path(PyObject *fullname, PyObject *name, PyObject *path,
|
|||
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 @@ find_module_path(PyObject *fullname, PyObject *name, PyObject *path,
|
|||
#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 @@ import_module_level(PyObject *name, PyObject *globals, PyObject *locals,
|
|||
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");
|
||||
|
|
Loading…
Reference in New Issue