diff options
author | Damien George <damien.p.george@gmail.com> | 2015-01-21 19:14:25 +0000 |
---|---|---|
committer | Damien George <damien.p.george@gmail.com> | 2015-01-21 23:17:27 +0000 |
commit | 0b9ee86133a2a0524691c6cdac209dbfcb3bf116 (patch) | |
tree | e17f1f8c26b2d92991a8481ba5d2fc0649a8c6ce /py/obj.h | |
parent | 2e526ff1a15cfe50aa46fe5611d3160b2a854f49 (diff) | |
download | micropython-0b9ee86133a2a0524691c6cdac209dbfcb3bf116.tar.gz micropython-0b9ee86133a2a0524691c6cdac209dbfcb3bf116.zip |
py: Add mp_obj_new_str_from_vstr, and use it where relevant.
This patch allows to reuse vstr memory when creating str/bytes object.
This improves memory usage.
Also saves code ROM: 128 bytes on stmhal, 92 bytes on bare-arm, and 88
bytes on unix x64.
Diffstat (limited to 'py/obj.h')
-rw-r--r-- | py/obj.h | 1 |
1 files changed, 1 insertions, 0 deletions
@@ -400,6 +400,7 @@ mp_obj_t mp_obj_new_int_from_str_len(const char **str, mp_uint_t len, bool neg, mp_obj_t mp_obj_new_int_from_ll(long long val); // this must return a multi-precision integer object (or raise an overflow exception) 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, mp_uint_t len, bool make_qstr_if_not_already); +mp_obj_t mp_obj_new_str_from_vstr(const mp_obj_type_t *type, vstr_t *vstr); mp_obj_t mp_obj_new_bytes(const byte* data, mp_uint_t len); mp_obj_t mp_obj_new_bytearray(mp_uint_t n, void *items); mp_obj_t mp_obj_new_bytearray_by_ref(mp_uint_t n, void *items); |