summaryrefslogtreecommitdiff
path: root/extmod/modnetwork.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 /extmod/modnetwork.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 'extmod/modnetwork.c')
-rw-r--r--extmod/modnetwork.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/extmod/modnetwork.c b/extmod/modnetwork.c
index 88f9d3718..f3d7d0faa 100644
--- a/extmod/modnetwork.c
+++ b/extmod/modnetwork.c
@@ -127,7 +127,7 @@ MP_DEFINE_CONST_FUN_OBJ_VAR_BETWEEN(mod_network_country_obj, 0, 1, network_count
mp_obj_t mod_network_hostname(size_t n_args, const mp_obj_t *args) {
if (n_args == 0) {
- return mp_obj_new_str(mod_network_hostname_data, strlen(mod_network_hostname_data));
+ return mp_obj_new_str_from_cstr(mod_network_hostname_data);
} else {
size_t len;
const char *str = mp_obj_str_get_data(args[0], &len);