diff options
| author | Victor Stinner <victor.stinner@haypocalc.com> | 2011-09-28 22:42:28 (GMT) |
|---|---|---|
| committer | Victor Stinner <victor.stinner@haypocalc.com> | 2011-09-28 22:42:28 (GMT) |
| commit | 639418812f11749f99d1160b26325bdfa3a26a6f (patch) | |
| tree | eb438b6f5e06b7a5144567ff5c95c190bf850cc1 /Objects | |
| parent | b9dcffb51e0075f70434febb6ea557cc4d22f5fd (diff) | |
| download | cpython-639418812f11749f99d1160b26325bdfa3a26a6f.zip cpython-639418812f11749f99d1160b26325bdfa3a26a6f.tar.gz cpython-639418812f11749f99d1160b26325bdfa3a26a6f.tar.bz2 | |
Use the new Py_ARRAY_LENGTH macro
Diffstat (limited to 'Objects')
| -rw-r--r-- | Objects/longobject.c | 3 | ||||
| -rw-r--r-- | Objects/typeobject.c | 4 | ||||
| -rw-r--r-- | Objects/unicodeobject.c | 2 |
3 files changed, 4 insertions, 5 deletions
diff --git a/Objects/longobject.c b/Objects/longobject.c index 85b3353..43e5f01 100644 --- a/Objects/longobject.c +++ b/Objects/longobject.c @@ -2444,8 +2444,7 @@ _PyLong_Frexp(PyLongObject *a, Py_ssize_t *e) break; } } - assert(1 <= x_size && - x_size <= (Py_ssize_t)(sizeof(x_digits)/sizeof(digit))); + assert(1 <= x_size && x_size <= (Py_ssize_t)Py_ARRAY_LENGTH(x_digits)); /* Round, and convert to double. */ x_digits[0] += half_even_correction[x_digits[0] & 7]; diff --git a/Objects/typeobject.c b/Objects/typeobject.c index 32b2672..2e6eb0a 100644 --- a/Objects/typeobject.c +++ b/Objects/typeobject.c @@ -2355,7 +2355,7 @@ PyObject* PyType_FromSpec(PyType_Spec *spec) res->ht_type.tp_flags = spec->flags | Py_TPFLAGS_HEAPTYPE; for (slot = spec->slots; slot->slot; slot++) { - if (slot->slot >= sizeof(slotoffsets)/sizeof(slotoffsets[0])) { + if (slot->slot >= Py_ARRAY_LENGTH(slotoffsets)) { PyErr_SetString(PyExc_RuntimeError, "invalid slot offset"); goto fail; } @@ -2583,7 +2583,7 @@ type_prepare(PyObject *self, PyObject *args, PyObject *kwds) return PyDict_New(); } -/* +/* Merge the __dict__ of aclass into dict, and recursively also all the __dict__s of aclass's base classes. The order of merging isn't defined, as it's expected that only the final set of dict keys is diff --git a/Objects/unicodeobject.c b/Objects/unicodeobject.c index bff74d9..387974d 100644 --- a/Objects/unicodeobject.c +++ b/Objects/unicodeobject.c @@ -12552,7 +12552,7 @@ void _PyUnicode_Init(void) /* initialize the linebreak bloom filter */ bloom_linebreak = make_bloom_mask( PyUnicode_2BYTE_KIND, linebreak, - sizeof(linebreak) / sizeof(linebreak[0])); + Py_ARRAY_LENGTH(linebreak)); PyType_Ready(&EncodingMapType); } |
