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 /py/obj.h | |
| 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 'py/obj.h')
| -rw-r--r-- | py/obj.h | 3 |
1 files changed, 2 insertions, 1 deletions
@@ -791,7 +791,8 @@ mp_obj_t mp_obj_new_int_from_ll(long long val); // this must return a multi-prec mp_obj_t mp_obj_new_int_from_ull(unsigned long long val); // this must return a multi-precision integer object (or raise an overflow exception) mp_obj_t mp_obj_new_str(const char *data, size_t len); mp_obj_t mp_obj_new_str_via_qstr(const char *data, size_t len); -mp_obj_t mp_obj_new_str_from_vstr(const mp_obj_type_t *type, vstr_t *vstr); +mp_obj_t mp_obj_new_str_from_vstr(vstr_t *vstr); +mp_obj_t mp_obj_new_bytes_from_vstr(vstr_t *vstr); mp_obj_t mp_obj_new_bytes(const byte *data, size_t len); mp_obj_t mp_obj_new_bytearray(size_t n, const void *items); mp_obj_t mp_obj_new_bytearray_by_ref(size_t n, void *items); |
