py/objmap: Convert mp_uint_t to size_t.

This commit is contained in:
Damien George 2017-03-27 12:19:24 +11:00
parent f648e5442b
commit 54507f78ee

View File

@ -31,7 +31,7 @@
typedef struct _mp_obj_map_t { typedef struct _mp_obj_map_t {
mp_obj_base_t base; mp_obj_base_t base;
mp_uint_t n_iters; size_t n_iters;
mp_obj_t fun; mp_obj_t fun;
mp_obj_t iters[]; mp_obj_t iters[];
} mp_obj_map_t; } mp_obj_map_t;
@ -42,7 +42,7 @@ STATIC mp_obj_t map_make_new(const mp_obj_type_t *type, size_t n_args, size_t n_
o->base.type = type; o->base.type = type;
o->n_iters = n_args - 1; o->n_iters = n_args - 1;
o->fun = args[0]; o->fun = args[0];
for (mp_uint_t i = 0; i < n_args - 1; i++) { for (size_t i = 0; i < n_args - 1; i++) {
o->iters[i] = mp_getiter(args[i + 1], NULL); o->iters[i] = mp_getiter(args[i + 1], NULL);
} }
return MP_OBJ_FROM_PTR(o); return MP_OBJ_FROM_PTR(o);
@ -53,7 +53,7 @@ STATIC mp_obj_t map_iternext(mp_obj_t self_in) {
mp_obj_map_t *self = MP_OBJ_TO_PTR(self_in); mp_obj_map_t *self = MP_OBJ_TO_PTR(self_in);
mp_obj_t *nextses = m_new(mp_obj_t, self->n_iters); mp_obj_t *nextses = m_new(mp_obj_t, self->n_iters);
for (mp_uint_t i = 0; i < self->n_iters; i++) { for (size_t i = 0; i < self->n_iters; i++) {
mp_obj_t next = mp_iternext(self->iters[i]); mp_obj_t next = mp_iternext(self->iters[i]);
if (next == MP_OBJ_STOP_ITERATION) { if (next == MP_OBJ_STOP_ITERATION) {
m_del(mp_obj_t, nextses, self->n_iters); m_del(mp_obj_t, nextses, self->n_iters);