diff --git a/py/builtin.c b/py/builtin.c index 76b3b83ff4..b64d5ca67a 100644 --- a/py/builtin.c +++ b/py/builtin.c @@ -357,8 +357,9 @@ STATIC mp_obj_t mp_builtin_oct(mp_obj_t o_in) { MP_DEFINE_CONST_FUN_OBJ_1(mp_builtin_oct_obj, mp_builtin_oct); STATIC mp_obj_t mp_builtin_ord(mp_obj_t o_in) { - uint len, charlen; - const char *str = mp_obj_str_get_data_len(o_in, &len, &charlen); + uint len; + const char *str = mp_obj_str_get_data(o_in, &len); + uint charlen = unichar_charlen(str, len); if (charlen == 1) { if (MP_OBJ_IS_STR(o_in) && UTF8_IS_NONASCII(*str)) { machine_int_t ord = *str++ & 0x7F; diff --git a/py/obj.h b/py/obj.h index 81e5296194..c4a9a603fa 100644 --- a/py/obj.h +++ b/py/obj.h @@ -468,7 +468,6 @@ uint mp_obj_str_get_len(mp_obj_t self_in); qstr mp_obj_str_get_qstr(mp_obj_t self_in); // use this if you will anyway convert the string to a qstr const char *mp_obj_str_get_str(mp_obj_t self_in); // use this only if you need the string to be null terminated const char *mp_obj_str_get_data(mp_obj_t self_in, uint *len); -const char *mp_obj_str_get_data_len(mp_obj_t self_in, uint *len, uint *charlen); void mp_str_print_quoted(void (*print)(void *env, const char *fmt, ...), void *env, const byte *str_data, uint str_len, bool is_bytes); #if MICROPY_PY_BUILTINS_FLOAT diff --git a/py/objstr.c b/py/objstr.c index 8ace52b8ee..db3490facb 100644 --- a/py/objstr.c +++ b/py/objstr.c @@ -1886,16 +1886,6 @@ const char *mp_obj_str_get_data(mp_obj_t self_in, uint *len) { } } -const char *mp_obj_str_get_data_len(mp_obj_t self_in, uint *len, uint *charlen) { - if (is_str_or_bytes(self_in)) { - GET_STR_INFO(self_in, s, l, cl); - *len = l; *charlen = cl; - return (const char*)s; - } else { - bad_implicit_conversion(self_in); - } -} - /******************************************************************************/ /* str iterator */