3636#include "runtime.h"
3737#include "objlist.h"
3838
39- STATIC mp_obj_t mp_obj_new_list_iterator (mp_obj_list_t * list , int cur );
40- STATIC mp_obj_list_t * list_new (uint n );
39+ STATIC mp_obj_t mp_obj_new_list_iterator (mp_obj_list_t * list , mp_uint_t cur );
40+ STATIC mp_obj_list_t * list_new (mp_uint_t n );
4141STATIC mp_obj_t list_extend (mp_obj_t self_in , mp_obj_t arg_in );
4242STATIC mp_obj_t list_pop (mp_uint_t n_args , const mp_obj_t * args );
4343
@@ -50,7 +50,7 @@ STATIC mp_obj_t list_pop(mp_uint_t n_args, const mp_obj_t *args);
5050STATIC void list_print (void (* print )(void * env , const char * fmt , ...), void * env , mp_obj_t o_in , mp_print_kind_t kind ) {
5151 mp_obj_list_t * o = o_in ;
5252 print (env , "[" );
53- for (int i = 0 ; i < o -> len ; i ++ ) {
53+ for (mp_uint_t i = 0 ; i < o -> len ; i ++ ) {
5454 if (i > 0 ) {
5555 print (env , ", " );
5656 }
@@ -188,7 +188,7 @@ STATIC mp_obj_t list_subscr(mp_obj_t self_in, mp_obj_t index, mp_obj_t value) {
188188 return res ;
189189 }
190190#endif
191- uint index_val = mp_get_index (self -> base .type , self -> len , index , false);
191+ mp_uint_t index_val = mp_get_index (self -> base .type , self -> len , index , false);
192192 return self -> items [index_val ];
193193 } else {
194194#if MICROPY_PY_BUILTINS_SLICE
@@ -271,7 +271,7 @@ STATIC mp_obj_t list_pop(mp_uint_t n_args, const mp_obj_t *args) {
271271 if (self -> len == 0 ) {
272272 nlr_raise (mp_obj_new_exception_msg (& mp_type_IndexError , "pop from empty list" ));
273273 }
274- uint index = mp_get_index (self -> base .type , self -> len , n_args == 1 ? MP_OBJ_NEW_SMALL_INT (-1 ) : args [1 ], false);
274+ mp_uint_t index = mp_get_index (self -> base .type , self -> len , n_args == 1 ? MP_OBJ_NEW_SMALL_INT (-1 ) : args [1 ], false);
275275 mp_obj_t ret = self -> items [index ];
276276 self -> len -= 1 ;
277277 memmove (self -> items + index , self -> items + index + 1 , (self -> len - index ) * sizeof (mp_obj_t ));
@@ -286,7 +286,7 @@ STATIC mp_obj_t list_pop(mp_uint_t n_args, const mp_obj_t *args) {
286286
287287// TODO make this conform to CPython's definition of sort
288288STATIC void mp_quicksort (mp_obj_t * head , mp_obj_t * tail , mp_obj_t key_fn , bool reversed ) {
289- int op = reversed ? MP_BINARY_OP_MORE : MP_BINARY_OP_LESS ;
289+ mp_uint_t op = reversed ? MP_BINARY_OP_MORE : MP_BINARY_OP_LESS ;
290290 while (head < tail ) {
291291 mp_obj_t * h = head - 1 ;
292292 mp_obj_t * t = tail ;
@@ -442,37 +442,37 @@ const mp_obj_type_t mp_type_list = {
442442 .locals_dict = (mp_obj_t )& list_locals_dict ,
443443};
444444
445- void mp_obj_list_init (mp_obj_list_t * o , uint n ) {
445+ void mp_obj_list_init (mp_obj_list_t * o , mp_uint_t n ) {
446446 o -> base .type = & mp_type_list ;
447447 o -> alloc = n < LIST_MIN_ALLOC ? LIST_MIN_ALLOC : n ;
448448 o -> len = n ;
449449 o -> items = m_new (mp_obj_t , o -> alloc );
450450 mp_seq_clear (o -> items , n , o -> alloc , sizeof (* o -> items ));
451451}
452452
453- STATIC mp_obj_list_t * list_new (uint n ) {
453+ STATIC mp_obj_list_t * list_new (mp_uint_t n ) {
454454 mp_obj_list_t * o = m_new_obj (mp_obj_list_t );
455455 mp_obj_list_init (o , n );
456456 return o ;
457457}
458458
459- mp_obj_t mp_obj_new_list (uint n , mp_obj_t * items ) {
459+ mp_obj_t mp_obj_new_list (mp_uint_t n , mp_obj_t * items ) {
460460 mp_obj_list_t * o = list_new (n );
461461 if (items != NULL ) {
462- for (int i = 0 ; i < n ; i ++ ) {
462+ for (mp_uint_t i = 0 ; i < n ; i ++ ) {
463463 o -> items [i ] = items [i ];
464464 }
465465 }
466466 return o ;
467467}
468468
469- void mp_obj_list_get (mp_obj_t self_in , uint * len , mp_obj_t * * items ) {
469+ void mp_obj_list_get (mp_obj_t self_in , mp_uint_t * len , mp_obj_t * * items ) {
470470 mp_obj_list_t * self = self_in ;
471471 * len = self -> len ;
472472 * items = self -> items ;
473473}
474474
475- void mp_obj_list_set_len (mp_obj_t self_in , uint len ) {
475+ void mp_obj_list_set_len (mp_obj_t self_in , mp_uint_t len ) {
476476 // trust that the caller knows what it's doing
477477 // TODO realloc if len got much smaller than alloc
478478 mp_obj_list_t * self = self_in ;
@@ -481,7 +481,7 @@ void mp_obj_list_set_len(mp_obj_t self_in, uint len) {
481481
482482void mp_obj_list_store (mp_obj_t self_in , mp_obj_t index , mp_obj_t value ) {
483483 mp_obj_list_t * self = self_in ;
484- uint i = mp_get_index (self -> base .type , self -> len , index , false);
484+ mp_uint_t i = mp_get_index (self -> base .type , self -> len , index , false);
485485 self -> items [i ] = value ;
486486}
487487
@@ -512,7 +512,7 @@ STATIC const mp_obj_type_t mp_type_list_it = {
512512 .iternext = list_it_iternext ,
513513};
514514
515- mp_obj_t mp_obj_new_list_iterator (mp_obj_list_t * list , int cur ) {
515+ mp_obj_t mp_obj_new_list_iterator (mp_obj_list_t * list , mp_uint_t cur ) {
516516 mp_obj_list_it_t * o = m_new_obj (mp_obj_list_it_t );
517517 o -> base .type = & mp_type_list_it ;
518518 o -> list = list ;
0 commit comments