summaryrefslogtreecommitdiffstatshomepage
path: root/py/modbuiltins.c
diff options
context:
space:
mode:
authorJim Mussared <jim.mussared@gmail.com>2022-08-22 17:08:05 +1000
committerDamien George <damien@micropython.org>2022-08-26 16:43:55 +1000
commit8a0ee5a5c04e83f04d1c62029ac5ba7c74856507 (patch)
treeeaa10ed5c00b4c21eea7def9fd0fbf5001a97dd4 /py/modbuiltins.c
parent09879f99ca3a6c0e48353eb2aaa1c71ed237f126 (diff)
downloadmicropython-8a0ee5a5c04e83f04d1c62029ac5ba7c74856507.tar.gz
micropython-8a0ee5a5c04e83f04d1c62029ac5ba7c74856507.zip
py/objstr: Split mp_obj_str_from_vstr into bytes/str versions.
Previously the desired output type was specified. Now make the type part of the function name. Because this function is used in a few places this saves code size due to smaller call-site. This makes `mp_obj_new_str_type_from_vstr` a private function of objstr.c (which is almost the only place where the output type isn't a compile-time constant). This saves ~140 bytes on PYBV11. Signed-off-by: Jim Mussared <jim.mussared@gmail.com>
Diffstat (limited to 'py/modbuiltins.c')
-rw-r--r--py/modbuiltins.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/py/modbuiltins.c b/py/modbuiltins.c
index f3caccbc83..2459edda13 100644
--- a/py/modbuiltins.c
+++ b/py/modbuiltins.c
@@ -250,7 +250,7 @@ STATIC mp_obj_t mp_builtin_input(size_t n_args, const mp_obj_t *args) {
if (line.len == 0 && ret == CHAR_CTRL_D) {
mp_raise_type(&mp_type_EOFError);
}
- return mp_obj_new_str_from_vstr(&mp_type_str, &line);
+ return mp_obj_new_str_from_vstr(&line);
}
MP_DEFINE_CONST_FUN_OBJ_VAR_BETWEEN(mp_builtin_input_obj, 0, 1, mp_builtin_input);
@@ -467,7 +467,7 @@ STATIC mp_obj_t mp_builtin_repr(mp_obj_t o_in) {
mp_print_t print;
vstr_init_print(&vstr, 16, &print);
mp_obj_print_helper(&print, o_in, PRINT_REPR);
- return mp_obj_new_str_from_vstr(&mp_type_str, &vstr);
+ return mp_obj_new_str_from_vstr(&vstr);
}
MP_DEFINE_CONST_FUN_OBJ_1(mp_builtin_repr_obj, mp_builtin_repr);