diff options
| author | Jim Mussared <jim.mussared@gmail.com> | 2022-08-22 17:08:05 +1000 |
|---|---|---|
| committer | Damien George <damien@micropython.org> | 2022-08-26 16:43:55 +1000 |
| commit | 8a0ee5a5c04e83f04d1c62029ac5ba7c74856507 (patch) | |
| tree | eaa10ed5c00b4c21eea7def9fd0fbf5001a97dd4 /extmod/modujson.c | |
| parent | 09879f99ca3a6c0e48353eb2aaa1c71ed237f126 (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 'extmod/modujson.c')
| -rw-r--r-- | extmod/modujson.c | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/extmod/modujson.c b/extmod/modujson.c index 9a73e4501..57c50deec 100644 --- a/extmod/modujson.c +++ b/extmod/modujson.c @@ -67,7 +67,7 @@ STATIC mp_obj_t mod_ujson_dump_helper(size_t n_args, const mp_obj_t *pos_args, m vstr_t vstr; vstr_init_print(&vstr, 8, &print_ext.base); mp_obj_print_helper(&print_ext.base, pos_args[0], PRINT_JSON); - return mp_obj_new_str_from_vstr(&mp_type_str, &vstr); + return mp_obj_new_str_from_vstr(&vstr); } else { // dump(obj, stream) print_ext.base.data = MP_OBJ_TO_PTR(pos_args[1]); @@ -103,7 +103,7 @@ STATIC mp_obj_t mod_ujson_dumps(mp_obj_t obj) { mp_print_t print; vstr_init_print(&vstr, 8, &print); mp_obj_print_helper(&print, obj, PRINT_JSON); - return mp_obj_new_str_from_vstr(&mp_type_str, &vstr); + return mp_obj_new_str_from_vstr(&vstr); } STATIC MP_DEFINE_CONST_FUN_OBJ_1(mod_ujson_dumps_obj, mod_ujson_dumps); |
