Get rid of mp_obj_str_get_data_len() which was used in only one place

This commit is contained in:
Chris Angelico 2014-06-08 07:11:27 +10:00
parent a019ba968b
commit 5c1658ec71
3 changed files with 3 additions and 13 deletions

View File

@ -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;

View File

@ -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

View File

@ -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 */