summaryrefslogtreecommitdiff
path: root/py/sequence.c
diff options
context:
space:
mode:
authorDamien George <damien.p.george@gmail.com>2017-03-23 16:17:40 +1100
committerDamien George <damien.p.george@gmail.com>2017-03-23 16:17:40 +1100
commitc88cfe165b0ab39c5d9392fb02dd12f22be1a28d (patch)
treedf03d503b13f11fde8730956f4adf883ce153496 /py/sequence.c
parent3f3df435014cc835ce9357e15ddb8996c5866f43 (diff)
py: Use size_t as len argument and return type of mp_get_index.
These values are used to compute memory addresses and so size_t is the more appropriate type to use.
Diffstat (limited to 'py/sequence.c')
-rw-r--r--py/sequence.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/py/sequence.c b/py/sequence.c
index bc2cfc077..9aa3b6a89 100644
--- a/py/sequence.c
+++ b/py/sequence.c
@@ -239,8 +239,8 @@ bool mp_seq_cmp_objs(mp_uint_t op, const mp_obj_t *items1, mp_uint_t len1, const
mp_obj_t mp_seq_index_obj(const mp_obj_t *items, mp_uint_t len, mp_uint_t n_args, const mp_obj_t *args) {
mp_obj_type_t *type = mp_obj_get_type(args[0]);
mp_obj_t value = args[1];
- uint start = 0;
- uint stop = len;
+ size_t start = 0;
+ size_t stop = len;
if (n_args >= 3) {
start = mp_get_index(type, len, args[2], true);
@@ -249,7 +249,7 @@ mp_obj_t mp_seq_index_obj(const mp_obj_t *items, mp_uint_t len, mp_uint_t n_args
}
}
- for (mp_uint_t i = start; i < stop; i++) {
+ for (size_t i = start; i < stop; i++) {
if (mp_obj_equal(items[i], value)) {
// Common sense says this cannot overflow small int
return MP_OBJ_NEW_SMALL_INT(i);