py/objstringio: Add TODO comment about avoiding copying on .getvalue().
This commit is contained in:
parent
772c73fa16
commit
2ae6697300
@ -95,6 +95,7 @@ STATIC mp_uint_t stringio_write(mp_obj_t o_in, const void *buf, mp_uint_t size,
|
|||||||
STATIC mp_obj_t stringio_getvalue(mp_obj_t self_in) {
|
STATIC mp_obj_t stringio_getvalue(mp_obj_t self_in) {
|
||||||
mp_obj_stringio_t *self = MP_OBJ_TO_PTR(self_in);
|
mp_obj_stringio_t *self = MP_OBJ_TO_PTR(self_in);
|
||||||
check_stringio_is_open(self);
|
check_stringio_is_open(self);
|
||||||
|
// TODO: Try to avoid copying string
|
||||||
return mp_obj_new_str_of_type(STREAM_TO_CONTENT_TYPE(self), (byte*)self->vstr->buf, self->vstr->len);
|
return mp_obj_new_str_of_type(STREAM_TO_CONTENT_TYPE(self), (byte*)self->vstr->buf, self->vstr->len);
|
||||||
}
|
}
|
||||||
STATIC MP_DEFINE_CONST_FUN_OBJ_1(stringio_getvalue_obj, stringio_getvalue);
|
STATIC MP_DEFINE_CONST_FUN_OBJ_1(stringio_getvalue_obj, stringio_getvalue);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user