py: Slightly improve efficiency of mp_obj_new_str; rename str_new.

Reorder interning logic in mp_obj_new_str, to be more efficient.

str_new is globally accessible, so should be prefixed with mp_obj_.
This commit is contained in:
Damien George
2014-05-25 22:34:34 +01:00
parent 2617eebf2f
commit f600a6a085
4 changed files with 28 additions and 27 deletions

View File

@@ -36,4 +36,4 @@ typedef struct _mp_obj_str_t {
#define MP_DEFINE_STR_OBJ(obj_name, str) mp_obj_str_t obj_name = {{&mp_type_str}, 0, sizeof(str) - 1, (const byte*)str};
mp_obj_t mp_obj_str_format(uint n_args, const mp_obj_t *args);
mp_obj_t str_new(const mp_obj_type_t *type, const byte* data, uint len);
mp_obj_t mp_obj_new_str_of_type(const mp_obj_type_t *type, const byte* data, uint len);