summaryrefslogtreecommitdiffstatshomepage
path: root/ports/unix/coverage.c
diff options
context:
space:
mode:
authorJon Foster <jon@jon-foster.co.uk>2024-04-01 19:23:49 +0100
committerDamien George <damien@micropython.org>2024-07-04 15:55:03 +1000
commit92484d8822635c125a7648d5b056ff7f78d62ab3 (patch)
tree34f8731d56f4330fe0e8a0ca325cdedd8e2eaa8a /ports/unix/coverage.c
parent289b2dd87960a4cdf019013cecd489f0d0cabc26 (diff)
downloadmicropython-92484d8822635c125a7648d5b056ff7f78d62ab3.tar.gz
micropython-92484d8822635c125a7648d5b056ff7f78d62ab3.zip
all: Use new mp_obj_new_str_from_cstr() function.
Use new function mp_obj_new_str_from_cstr() where appropriate. It simplifies the code, and makes it smaller too. Signed-off-by: Jon Foster <jon@jon-foster.co.uk>
Diffstat (limited to 'ports/unix/coverage.c')
-rw-r--r--ports/unix/coverage.c8
1 files changed, 4 insertions, 4 deletions
diff --git a/ports/unix/coverage.c b/ports/unix/coverage.c
index b05e2dade6..99a6d8c8c1 100644
--- a/ports/unix/coverage.c
+++ b/ports/unix/coverage.c
@@ -388,7 +388,7 @@ static mp_obj_t extra_coverage(void) {
mp_printf(&mp_plat_print, "# str\n");
// intern string
- mp_printf(&mp_plat_print, "%d\n", mp_obj_is_qstr(mp_obj_str_intern(mp_obj_new_str("intern me", 9))));
+ mp_printf(&mp_plat_print, "%d\n", mp_obj_is_qstr(mp_obj_str_intern(mp_obj_new_str_from_cstr("intern me"))));
}
// bytearray
@@ -471,12 +471,12 @@ static mp_obj_t extra_coverage(void) {
// call mp_call_function_1_protected
mp_call_function_1_protected(MP_OBJ_FROM_PTR(&mp_builtin_abs_obj), MP_OBJ_NEW_SMALL_INT(1));
// call mp_call_function_1_protected with invalid args
- mp_call_function_1_protected(MP_OBJ_FROM_PTR(&mp_builtin_abs_obj), mp_obj_new_str("abc", 3));
+ mp_call_function_1_protected(MP_OBJ_FROM_PTR(&mp_builtin_abs_obj), mp_obj_new_str_from_cstr("abc"));
// call mp_call_function_2_protected
mp_call_function_2_protected(MP_OBJ_FROM_PTR(&mp_builtin_divmod_obj), MP_OBJ_NEW_SMALL_INT(1), MP_OBJ_NEW_SMALL_INT(1));
// call mp_call_function_2_protected with invalid args
- mp_call_function_2_protected(MP_OBJ_FROM_PTR(&mp_builtin_divmod_obj), mp_obj_new_str("abc", 3), mp_obj_new_str("abc", 3));
+ mp_call_function_2_protected(MP_OBJ_FROM_PTR(&mp_builtin_divmod_obj), mp_obj_new_str_from_cstr("abc"), mp_obj_new_str_from_cstr("abc"));
// mp_obj_int_get_checked with mp_obj_int_t that has a value that is a small integer
mp_printf(&mp_plat_print, "%d\n", mp_obj_int_get_checked(mp_obj_int_new_mpz()));
@@ -733,7 +733,7 @@ static mp_obj_t extra_coverage(void) {
// mp_obj_is_integer accepts ints and booleans
mp_printf(&mp_plat_print, "%d %d\n", mp_obj_is_integer(MP_OBJ_NEW_SMALL_INT(1)), mp_obj_is_integer(mp_obj_new_int_from_ll(1)));
mp_printf(&mp_plat_print, "%d %d\n", mp_obj_is_integer(mp_const_true), mp_obj_is_integer(mp_const_false));
- mp_printf(&mp_plat_print, "%d %d\n", mp_obj_is_integer(mp_obj_new_str("1", 1)), mp_obj_is_integer(mp_const_none));
+ mp_printf(&mp_plat_print, "%d %d\n", mp_obj_is_integer(mp_obj_new_str_from_cstr("1")), mp_obj_is_integer(mp_const_none));
// mp_obj_is_int accepts small int and object ints
mp_printf(&mp_plat_print, "%d %d\n", mp_obj_is_int(MP_OBJ_NEW_SMALL_INT(1)), mp_obj_is_int(mp_obj_new_int_from_ll(1)));