summaryrefslogtreecommitdiff
path: root/py
diff options
context:
space:
mode:
authorPaul Sokolovsky <pfalcon@users.sourceforge.net>2017-11-11 00:11:24 +0200
committerPaul Sokolovsky <pfalcon@users.sourceforge.net>2017-11-11 00:11:24 +0200
commitcada971113e6db0cf9e0751e95dbe9217dd707b5 (patch)
tree62482528ce41f4c77b868af3918805b79fcb2db6 /py
parent579b86451dba202d573c4c22790ebe3d8ddac060 (diff)
py/objtype: mp_obj_new_type: Name base types related vars more clearly.
As vars contains array of base types and its length, name them as such, avoid generic "items" and "len" names.
Diffstat (limited to 'py')
-rw-r--r--py/objtype.c20
1 files changed, 10 insertions, 10 deletions
diff --git a/py/objtype.c b/py/objtype.c
index 6e2ab6c9a..a8376a306 100644
--- a/py/objtype.c
+++ b/py/objtype.c
@@ -983,12 +983,12 @@ mp_obj_t mp_obj_new_type(qstr name, mp_obj_t bases_tuple, mp_obj_t locals_dict)
// TODO might need to make a copy of locals_dict; at least that's how CPython does it
// Basic validation of base classes
- size_t len;
- mp_obj_t *items;
- mp_obj_tuple_get(bases_tuple, &len, &items);
- for (size_t i = 0; i < len; i++) {
- assert(MP_OBJ_IS_TYPE(items[i], &mp_type_type));
- mp_obj_type_t *t = MP_OBJ_TO_PTR(items[i]);
+ size_t bases_len;
+ mp_obj_t *bases_items;
+ mp_obj_tuple_get(bases_tuple, &bases_len, &bases_items);
+ for (size_t i = 0; i < bases_len; i++) {
+ assert(MP_OBJ_IS_TYPE(bases_items[i], &mp_type_type));
+ mp_obj_type_t *t = MP_OBJ_TO_PTR(bases_items[i]);
// TODO: Verify with CPy, tested on function type
if (t->make_new == NULL) {
if (MICROPY_ERROR_REPORTING == MICROPY_ERROR_REPORTING_TERSE) {
@@ -1014,17 +1014,17 @@ mp_obj_t mp_obj_new_type(qstr name, mp_obj_t bases_tuple, mp_obj_t locals_dict)
//o->iternext = ; not implemented
o->buffer_p.get_buffer = instance_get_buffer;
- if (len > 0) {
+ if (bases_len > 0) {
// Inherit protocol from a base class. This allows to define an
// abstract base class which would translate C-level protocol to
// Python method calls, and any subclass inheriting from it will
// support this feature.
- o->protocol = ((mp_obj_type_t*)MP_OBJ_TO_PTR(items[0]))->protocol;
+ o->protocol = ((mp_obj_type_t*)MP_OBJ_TO_PTR(bases_items[0]))->protocol;
- if (len >= 2) {
+ if (bases_len >= 2) {
o->parent = MP_OBJ_TO_PTR(bases_tuple);
} else {
- o->parent = MP_OBJ_TO_PTR(items[0]);
+ o->parent = MP_OBJ_TO_PTR(bases_items[0]);
}
}