Skip to content

Commit 68cd3a9

Browse files
committed
py/objset: Convert mp_uint_t to size_t where appropriate.
1 parent 1ea2f7a commit 68cd3a9

2 files changed

Lines changed: 11 additions & 11 deletions

File tree

py/obj.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -633,7 +633,7 @@ mp_obj_t mp_obj_new_closure(mp_obj_t fun, mp_uint_t n_closed, const mp_obj_t *cl
633633
mp_obj_t mp_obj_new_tuple(size_t n, const mp_obj_t *items);
634634
mp_obj_t mp_obj_new_list(size_t n, mp_obj_t *items);
635635
mp_obj_t mp_obj_new_dict(size_t n_args);
636-
mp_obj_t mp_obj_new_set(mp_uint_t n_args, mp_obj_t *items);
636+
mp_obj_t mp_obj_new_set(size_t n_args, mp_obj_t *items);
637637
mp_obj_t mp_obj_new_slice(mp_obj_t start, mp_obj_t stop, mp_obj_t step);
638638
mp_obj_t mp_obj_new_super(mp_obj_t type, mp_obj_t obj);
639639
mp_obj_t mp_obj_new_bound_meth(mp_obj_t meth, mp_obj_t self);

py/objset.c

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ typedef struct _mp_obj_set_it_t {
4444
mp_obj_base_t base;
4545
mp_fun_1_t iternext;
4646
mp_obj_set_t *set;
47-
mp_uint_t cur;
47+
size_t cur;
4848
} mp_obj_set_it_t;
4949

5050
STATIC mp_obj_t set_it_iternext(mp_obj_t self_in);
@@ -96,7 +96,7 @@ STATIC void set_print(const mp_print_t *print, mp_obj_t self_in, mp_print_kind_t
9696
}
9797
#endif
9898
mp_print_str(print, "{");
99-
for (mp_uint_t i = 0; i < self->set.alloc; i++) {
99+
for (size_t i = 0; i < self->set.alloc; i++) {
100100
if (MP_SET_SLOT_IS_FILLED(&self->set, i)) {
101101
if (!first) {
102102
mp_print_str(print, ", ");
@@ -143,10 +143,10 @@ STATIC mp_obj_t set_make_new(const mp_obj_type_t *type, size_t n_args, size_t n_
143143

144144
STATIC mp_obj_t set_it_iternext(mp_obj_t self_in) {
145145
mp_obj_set_it_t *self = MP_OBJ_TO_PTR(self_in);
146-
mp_uint_t max = self->set->set.alloc;
146+
size_t max = self->set->set.alloc;
147147
mp_set_t *set = &self->set->set;
148148

149-
for (mp_uint_t i = self->cur; i < max; i++) {
149+
for (size_t i = self->cur; i < max; i++) {
150150
if (MP_SET_SLOT_IS_FILLED(set, i)) {
151151
self->cur = i + 1;
152152
return set->table[i];
@@ -228,7 +228,7 @@ STATIC mp_obj_t set_diff_int(size_t n_args, const mp_obj_t *args, bool update) {
228228
}
229229

230230

231-
for (mp_uint_t i = 1; i < n_args; i++) {
231+
for (size_t i = 1; i < n_args; i++) {
232232
mp_obj_t other = args[i];
233233
if (self == other) {
234234
set_clear(self);
@@ -436,7 +436,7 @@ STATIC void set_update_int(mp_obj_set_t *self, mp_obj_t other_in) {
436436

437437
STATIC mp_obj_t set_update(size_t n_args, const mp_obj_t *args) {
438438
check_set(args[0]);
439-
for (mp_uint_t i = 1; i < n_args; i++) {
439+
for (size_t i = 1; i < n_args; i++) {
440440
set_update_int(MP_OBJ_TO_PTR(args[0]), args[i]);
441441
}
442442

@@ -462,10 +462,10 @@ STATIC mp_obj_t set_unary_op(mp_uint_t op, mp_obj_t self_in) {
462462
if (MP_OBJ_IS_TYPE(self_in, &mp_type_frozenset)) {
463463
// start hash with unique value
464464
mp_int_t hash = (mp_int_t)(uintptr_t)&mp_type_frozenset;
465-
mp_uint_t max = self->set.alloc;
465+
size_t max = self->set.alloc;
466466
mp_set_t *set = &self->set;
467467

468-
for (mp_uint_t i = 0; i < max; i++) {
468+
for (size_t i = 0; i < max; i++) {
469469
if (MP_SET_SLOT_IS_FILLED(set, i)) {
470470
hash += MP_OBJ_SMALL_INT_VALUE(mp_unary_op(MP_UNARY_OP_HASH, set->table[i]));
471471
}
@@ -587,11 +587,11 @@ const mp_obj_type_t mp_type_frozenset = {
587587
};
588588
#endif
589589

590-
mp_obj_t mp_obj_new_set(mp_uint_t n_args, mp_obj_t *items) {
590+
mp_obj_t mp_obj_new_set(size_t n_args, mp_obj_t *items) {
591591
mp_obj_set_t *o = m_new_obj(mp_obj_set_t);
592592
o->base.type = &mp_type_set;
593593
mp_set_init(&o->set, n_args);
594-
for (mp_uint_t i = 0; i < n_args; i++) {
594+
for (size_t i = 0; i < n_args; i++) {
595595
mp_set_lookup(&o->set, items[i], MP_MAP_LOOKUP_ADD_IF_NOT_FOUND);
596596
}
597597
return MP_OBJ_FROM_PTR(o);

0 commit comments

Comments
 (0)