diff options
author | Damien George <damien.p.george@gmail.com> | 2017-03-25 19:35:08 +1100 |
---|---|---|
committer | Damien George <damien.p.george@gmail.com> | 2017-03-29 12:56:17 +1100 |
commit | 6213ad7f466df12c734dc527993bbb46c9d9eb5c (patch) | |
tree | f8a1c358820c211d5b6241e12c014628728408e0 /py/objstr.c | |
parent | f7816188b701552036c9f3f2c6d1eb06462087d1 (diff) | |
download | micropython-6213ad7f466df12c734dc527993bbb46c9d9eb5c.tar.gz micropython-6213ad7f466df12c734dc527993bbb46c9d9eb5c.zip |
py: Convert mp_uint_t to size_t for tuple/list accessors.
This patch changes mp_uint_t to size_t for the len argument of the
following public facing C functions:
mp_obj_tuple_get
mp_obj_list_get
mp_obj_get_array
These functions take a pointer to the len argument (to be filled in by the
function) and callers of these functions should update their code so the
type of len is changed to size_t. For ports that don't use nan-boxing
there should be no change in generate code because the size of the type
remains the same (word sized), and in a lot of cases there won't even be a
compiler warning if the type remains as mp_uint_t.
The reason for this change is to standardise on the use of size_t for
variables that count memory (or memory related) sizes/lengths. It helps
builds that use nan-boxing.
Diffstat (limited to 'py/objstr.c')
-rw-r--r-- | py/objstr.c | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/py/objstr.c b/py/objstr.c index 4053efb889..682bd26930 100644 --- a/py/objstr.c +++ b/py/objstr.c @@ -284,7 +284,7 @@ mp_obj_t mp_obj_str_binary_op(mp_uint_t op, mp_obj_t lhs_in, mp_obj_t rhs_in) { // check for modulo if (op == MP_BINARY_OP_MODULO) { mp_obj_t *args = &rhs_in; - mp_uint_t n_args = 1; + size_t n_args = 1; mp_obj_t dict = MP_OBJ_NULL; if (MP_OBJ_IS_TYPE(rhs_in, &mp_type_tuple)) { // TODO: Support tuple subclasses? @@ -428,7 +428,7 @@ STATIC mp_obj_t str_join(mp_obj_t self_in, mp_obj_t arg) { GET_STR_DATA_LEN(self_in, sep_str, sep_len); // process args - mp_uint_t seq_len; + size_t seq_len; mp_obj_t *seq_items; if (!MP_OBJ_IS_TYPE(arg, &mp_type_list) && !MP_OBJ_IS_TYPE(arg, &mp_type_tuple)) { |