summaryrefslogtreecommitdiff
path: root/py/binary.c
diff options
context:
space:
mode:
authorJon Foster <jon@jon-foster.co.uk>2024-04-01 19:23:49 +0100
committerDamien George <damien@micropython.org>2024-07-04 15:55:03 +1000
commit92484d8822635c125a7648d5b056ff7f78d62ab3 (patch)
tree34f8731d56f4330fe0e8a0ca325cdedd8e2eaa8a /py/binary.c
parent289b2dd87960a4cdf019013cecd489f0d0cabc26 (diff)
all: Use new mp_obj_new_str_from_cstr() function.
Use new function mp_obj_new_str_from_cstr() where appropriate. It simplifies the code, and makes it smaller too. Signed-off-by: Jon Foster <jon@jon-foster.co.uk>
Diffstat (limited to 'py/binary.c')
-rw-r--r--py/binary.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/py/binary.c b/py/binary.c
index 7c01cfa1c..4fc8f751a 100644
--- a/py/binary.c
+++ b/py/binary.c
@@ -338,7 +338,7 @@ mp_obj_t mp_binary_get_val(char struct_type, char val_type, byte *p_base, byte *
return (mp_obj_t)(mp_uint_t)val;
} else if (val_type == 'S') {
const char *s_val = (const char *)(uintptr_t)(mp_uint_t)val;
- return mp_obj_new_str(s_val, strlen(s_val));
+ return mp_obj_new_str_from_cstr(s_val);
#if MICROPY_PY_BUILTINS_FLOAT
} else if (val_type == 'e') {
return mp_obj_new_float_from_f(mp_decode_half_float(val));