diff options
author | Damien George <damien.p.george@gmail.com> | 2014-01-22 14:35:10 +0000 |
---|---|---|
committer | Damien George <damien.p.george@gmail.com> | 2014-01-22 14:35:10 +0000 |
commit | 5fa93b67557f21c22a41449c3266571c427f6798 (patch) | |
tree | 3e009ed9369b7aba8cf5212509a784ecd86e06a3 /py/objfun.c | |
parent | 8ae1c1beacc56d440b2cc1e4bd010b100ad4fdd0 (diff) | |
download | micropython-5fa93b67557f21c22a41449c3266571c427f6798.tar.gz micropython-5fa93b67557f21c22a41449c3266571c427f6798.zip |
Second stage of qstr revamp: uPy str object can be qstr or not.
Diffstat (limited to 'py/objfun.c')
-rw-r--r-- | py/objfun.c | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/py/objfun.c b/py/objfun.c index b749860c25..1f6ad68ea4 100644 --- a/py/objfun.c +++ b/py/objfun.c @@ -56,8 +56,7 @@ mp_obj_t fun_native_call(mp_obj_t self_in, uint n_args, uint n_kw, const mp_obj_ // TODO if n_kw==0 then don't allocate any memory for map (either pass NULL or allocate it on the heap) mp_map_t *kw_args = mp_map_new(n_kw); for (int i = 0; i < 2 * n_kw; i += 2) { - qstr name = mp_obj_str_get(args[n_args + i]); - mp_map_lookup(kw_args, MP_OBJ_NEW_QSTR(name), MP_MAP_LOOKUP_ADD_IF_NOT_FOUND)->value = args[n_args + i + 1]; + mp_map_lookup(kw_args, args[n_args + i], MP_MAP_LOOKUP_ADD_IF_NOT_FOUND)->value = args[n_args + i + 1]; } mp_obj_t res = ((mp_fun_kw_t)self->fun)(n_args, args, kw_args); // TODO clean up kw_args @@ -214,9 +213,10 @@ machine_uint_t convert_obj_for_inline_asm(mp_obj_t obj) { return 0; } else if (obj == mp_const_true) { return 1; - } else if (MP_OBJ_IS_TYPE(obj, &str_type)) { + } else if (MP_OBJ_IS_STR(obj)) { // pointer to the string (it's probably constant though!) - return (machine_uint_t)qstr_str(mp_obj_str_get(obj)); + uint l; + return (machine_uint_t)mp_obj_str_get_data(obj, &l); #if MICROPY_ENABLE_FLOAT } else if (MP_OBJ_IS_TYPE(obj, &float_type)) { // convert float to int (could also pass in float registers) |