aboutsummaryrefslogtreecommitdiff
path: root/py/objstr.c
diff options
context:
space:
mode:
authorDamien George <damien.p.george@gmail.com>2017-08-29 13:04:01 +1000
committerDamien George <damien.p.george@gmail.com>2017-08-29 13:16:30 +1000
commit58321dd9854d71a96e5db2d361e0efc05d9de8cf (patch)
tree99868b98083b1b25715303ee6f2b62835492ffce /py/objstr.c
parentbe8e5744e64aec10a3499fd6ea034bbf4be0c871 (diff)
all: Convert mp_uint_t to mp_unary_op_t/mp_binary_op_t where appropriate
The unary-op/binary-op enums are already defined, and there are no arithmetic tricks used with these types, so it makes sense to use the correct enum type for arguments that take these values. It also reduces code size quite a bit for nan-boxing builds.
Diffstat (limited to 'py/objstr.c')
-rw-r--r--py/objstr.c7
1 files changed, 4 insertions, 3 deletions
diff --git a/py/objstr.c b/py/objstr.c
index f04bd90be..4c287af04 100644
--- a/py/objstr.c
+++ b/py/objstr.c
@@ -280,7 +280,7 @@ const byte *find_subbytes(const byte *haystack, size_t hlen, const byte *needle,
// Note: this function is used to check if an object is a str or bytes, which
// works because both those types use it as their binary_op method. Revisit
// MP_OBJ_IS_STR_OR_BYTES if this fact changes.
-mp_obj_t mp_obj_str_binary_op(mp_uint_t op, mp_obj_t lhs_in, mp_obj_t rhs_in) {
+mp_obj_t mp_obj_str_binary_op(mp_binary_op_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;
@@ -380,9 +380,10 @@ mp_obj_t mp_obj_str_binary_op(mp_uint_t op, mp_obj_t lhs_in, mp_obj_t rhs_in) {
case MP_BINARY_OP_MORE:
case MP_BINARY_OP_MORE_EQUAL:
return mp_obj_new_bool(mp_seq_cmp_bytes(op, lhs_data, lhs_len, rhs_data, rhs_len));
- }
- return MP_OBJ_NULL; // op not supported
+ default:
+ return MP_OBJ_NULL; // op not supported
+ }
}
#if !MICROPY_PY_BUILTINS_STR_UNICODE