summaryrefslogtreecommitdiff
path: root/ports/unix/moduos.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 /ports/unix/moduos.c
parent09879f99ca3a6c0e48353eb2aaa1c71ed237f126 (diff)
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 'ports/unix/moduos.c')
-rw-r--r--ports/unix/moduos.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/ports/unix/moduos.c b/ports/unix/moduos.c
index b577dbd29..854ff335f 100644
--- a/ports/unix/moduos.c
+++ b/ports/unix/moduos.c
@@ -94,7 +94,7 @@ STATIC mp_obj_t mp_uos_urandom(mp_obj_t num) {
vstr_t vstr;
vstr_init_len(&vstr, n);
mp_hal_get_random(n, vstr.buf);
- return mp_obj_new_str_from_vstr(&mp_type_bytes, &vstr);
+ return mp_obj_new_bytes_from_vstr(&vstr);
}
STATIC MP_DEFINE_CONST_FUN_OBJ_1(mp_uos_urandom_obj, mp_uos_urandom);