From d915a52eb650a0809e15e6be25e58a3db7e73025 Mon Sep 17 00:00:00 2001 From: Paul Sokolovsky Date: Sat, 10 May 2014 21:36:33 +0300 Subject: [PATCH] py: Fix prefix on few sequence helpers, was incorrectly "mp_". --- py/obj.h | 6 +++--- py/objarray.c | 2 +- py/objlist.c | 6 +++--- py/objstr.c | 2 +- py/objtuple.c | 6 +++--- py/runtime.c | 8 ++++---- py/sequence.c | 2 +- 7 files changed, 16 insertions(+), 16 deletions(-) diff --git a/py/obj.h b/py/obj.h index 089b953d76..0ec3c29ef6 100644 --- a/py/obj.h +++ b/py/obj.h @@ -564,9 +564,9 @@ const mp_obj_t *mp_obj_property_get(mp_obj_t self_in); // sequence helpers void mp_seq_multiply(const void *items, uint item_sz, uint len, uint times, void *dest); -bool m_seq_get_fast_slice_indexes(machine_uint_t len, mp_obj_t slice, machine_uint_t *begin, machine_uint_t *end); -#define m_seq_copy(dest, src, len, item_t) memcpy(dest, src, len * sizeof(item_t)) -#define m_seq_cat(dest, src1, len1, src2, len2, item_t) { memcpy(dest, src1, (len1) * sizeof(item_t)); memcpy(dest + (len1), src2, (len2) * sizeof(item_t)); } +bool mp_seq_get_fast_slice_indexes(machine_uint_t len, mp_obj_t slice, machine_uint_t *begin, machine_uint_t *end); +#define mp_seq_copy(dest, src, len, item_t) memcpy(dest, src, len * sizeof(item_t)) +#define mp_seq_cat(dest, src1, len1, src2, len2, item_t) { memcpy(dest, src1, (len1) * sizeof(item_t)); memcpy(dest + (len1), src2, (len2) * sizeof(item_t)); } bool mp_seq_cmp_bytes(int op, const byte *data1, uint len1, const byte *data2, uint len2); bool mp_seq_cmp_objs(int op, const mp_obj_t *items1, uint len1, const mp_obj_t *items2, uint len2); mp_obj_t mp_seq_index_obj(const mp_obj_t *items, uint len, uint n_args, const mp_obj_t *args); diff --git a/py/objarray.c b/py/objarray.c index 6fca4a4317..b394d77461 100644 --- a/py/objarray.c +++ b/py/objarray.c @@ -176,7 +176,7 @@ STATIC mp_obj_t array_subscr(mp_obj_t self_in, mp_obj_t index_in, mp_obj_t value return MP_OBJ_NOT_SUPPORTED; } machine_uint_t start, stop; - if (!m_seq_get_fast_slice_indexes(o->len, index_in, &start, &stop)) { + if (!mp_seq_get_fast_slice_indexes(o->len, index_in, &start, &stop)) { assert(0); } mp_obj_array_t *res = array_new(o->typecode, stop - start); diff --git a/py/objlist.c b/py/objlist.c index 2a5de35051..08c1716179 100644 --- a/py/objlist.c +++ b/py/objlist.c @@ -119,7 +119,7 @@ STATIC mp_obj_t list_binary_op(int op, mp_obj_t lhs, mp_obj_t rhs) { } mp_obj_list_t *p = rhs; mp_obj_list_t *s = list_new(o->len + p->len); - m_seq_cat(s->items, o->items, o->len, p->items, p->len, mp_obj_t); + mp_seq_cat(s->items, o->items, o->len, p->items, p->len, mp_obj_t); return s; } case MP_BINARY_OP_INPLACE_ADD: { @@ -162,11 +162,11 @@ STATIC mp_obj_t list_subscr(mp_obj_t self_in, mp_obj_t index, mp_obj_t value) { #if MICROPY_ENABLE_SLICE if (MP_OBJ_IS_TYPE(index, &mp_type_slice)) { machine_uint_t start, stop; - if (!m_seq_get_fast_slice_indexes(self->len, index, &start, &stop)) { + if (!mp_seq_get_fast_slice_indexes(self->len, index, &start, &stop)) { assert(0); } mp_obj_list_t *res = list_new(stop - start); - m_seq_copy(res->items, self->items + start, res->len, mp_obj_t); + mp_seq_copy(res->items, self->items + start, res->len, mp_obj_t); return res; } #endif diff --git a/py/objstr.c b/py/objstr.c index 26c6edde9e..80b0cf8766 100644 --- a/py/objstr.c +++ b/py/objstr.c @@ -333,7 +333,7 @@ STATIC mp_obj_t str_subscr(mp_obj_t self_in, mp_obj_t index, mp_obj_t value) { #if MICROPY_ENABLE_SLICE if (MP_OBJ_IS_TYPE(index, &mp_type_slice)) { machine_uint_t start, stop; - if (!m_seq_get_fast_slice_indexes(self_len, index, &start, &stop)) { + if (!mp_seq_get_fast_slice_indexes(self_len, index, &start, &stop)) { assert(0); } return mp_obj_new_str(self_data + start, stop - start, false); diff --git a/py/objtuple.c b/py/objtuple.c index 109e3ba675..7d4e87755f 100644 --- a/py/objtuple.c +++ b/py/objtuple.c @@ -127,7 +127,7 @@ mp_obj_t tuple_binary_op(int op, mp_obj_t lhs, mp_obj_t rhs) { } mp_obj_tuple_t *p = rhs; mp_obj_tuple_t *s = mp_obj_new_tuple(o->len + p->len, NULL); - m_seq_cat(s->items, o->items, o->len, p->items, p->len, mp_obj_t); + mp_seq_cat(s->items, o->items, o->len, p->items, p->len, mp_obj_t); return s; } case MP_BINARY_OP_MULTIPLY: { @@ -159,11 +159,11 @@ mp_obj_t tuple_subscr(mp_obj_t self_in, mp_obj_t index, mp_obj_t value) { #if MICROPY_ENABLE_SLICE if (MP_OBJ_IS_TYPE(index, &mp_type_slice)) { machine_uint_t start, stop; - if (!m_seq_get_fast_slice_indexes(self->len, index, &start, &stop)) { + if (!mp_seq_get_fast_slice_indexes(self->len, index, &start, &stop)) { assert(0); } mp_obj_tuple_t *res = mp_obj_new_tuple(stop - start, NULL); - m_seq_copy(res->items, self->items + start, res->len, mp_obj_t); + mp_seq_copy(res->items, self->items + start, res->len, mp_obj_t); return res; } #endif diff --git a/py/runtime.c b/py/runtime.c index f8eac40609..1479d8cba3 100644 --- a/py/runtime.c +++ b/py/runtime.c @@ -578,7 +578,7 @@ mp_obj_t mp_call_method_n_kw_var(bool have_self, uint n_args_n_kw, const mp_obj_ } // copy the fixed pos args - m_seq_copy(args2 + args2_len, args, n_args, mp_obj_t); + mp_seq_copy(args2 + args2_len, args, n_args, mp_obj_t); args2_len += n_args; } else if (MP_OBJ_IS_TYPE(pos_seq, &mp_type_tuple) || MP_OBJ_IS_TYPE(pos_seq, &mp_type_list)) { @@ -599,7 +599,7 @@ mp_obj_t mp_call_method_n_kw_var(bool have_self, uint n_args_n_kw, const mp_obj_ } // copy the fixed and variable position args - m_seq_cat(args2 + args2_len, args, n_args, items, len, mp_obj_t); + mp_seq_cat(args2 + args2_len, args, n_args, items, len, mp_obj_t); args2_len += n_args + len; } else { @@ -615,7 +615,7 @@ mp_obj_t mp_call_method_n_kw_var(bool have_self, uint n_args_n_kw, const mp_obj_ } // copy the fixed position args - m_seq_copy(args2 + args2_len, args, n_args, mp_obj_t); + mp_seq_copy(args2 + args2_len, args, n_args, mp_obj_t); // extract the variable position args from the iterator mp_obj_t iterable = mp_getiter(pos_seq); @@ -633,7 +633,7 @@ mp_obj_t mp_call_method_n_kw_var(bool have_self, uint n_args_n_kw, const mp_obj_ uint pos_args_len = args2_len; // Copy the fixed kw args. - m_seq_copy(args2 + args2_len, args + n_args, 2 * n_kw, mp_obj_t); + mp_seq_copy(args2 + args2_len, args + n_args, 2 * n_kw, mp_obj_t); args2_len += 2 * n_kw; // Extract (key,value) pairs from kw_dict dictionary and append to args2. diff --git a/py/sequence.c b/py/sequence.c index 3d2bbba4df..91162fc099 100644 --- a/py/sequence.c +++ b/py/sequence.c @@ -50,7 +50,7 @@ void mp_seq_multiply(const void *items, uint item_sz, uint len, uint times, void } } -bool m_seq_get_fast_slice_indexes(machine_uint_t len, mp_obj_t slice, machine_uint_t *begin, machine_uint_t *end) { +bool mp_seq_get_fast_slice_indexes(machine_uint_t len, mp_obj_t slice, machine_uint_t *begin, machine_uint_t *end) { machine_int_t start, stop, step; mp_obj_slice_get(slice, &start, &stop, &step); if (step != 1) {