aboutsummaryrefslogtreecommitdiff
path: root/ports/esp8266
diff options
context:
space:
mode:
authorDamien George2017-11-16 13:17:51 +1100
committerDamien George2017-11-16 13:17:51 +1100
commit4601759bf59e16b860a3f082e9aa4ea78356bf92 (patch)
tree138bedf76b8b9155835bbaf935f2c108d8ff3ec0 /ports/esp8266
parent6bc55b657b900dd92ebb8b4a8c393644a30dd7e6 (diff)
py/objstr: Remove "make_qstr_if_not_already" arg from mp_obj_new_str.
This patch simplifies the str creation API to favour the common case of creating a str object that is not forced to be interned. To force interning of a new str the new mp_obj_new_str_via_qstr function is added, and should only be used if warranted. Apart from simplifying the mp_obj_new_str function (and making it have the same signature as mp_obj_new_bytes), this patch also reduces code size by a bit (-16 bytes for bare-arm and roughly -40 bytes on the bare-metal archs).
Diffstat (limited to 'ports/esp8266')
-rw-r--r--ports/esp8266/modnetwork.c4
-rw-r--r--ports/esp8266/moduos.c2
2 files changed, 3 insertions, 3 deletions
diff --git a/ports/esp8266/modnetwork.c b/ports/esp8266/modnetwork.c
index b41a11f59..4066c969c 100644
--- a/ports/esp8266/modnetwork.c
+++ b/ports/esp8266/modnetwork.c
@@ -411,7 +411,7 @@ STATIC mp_obj_t esp_config(size_t n_args, const mp_obj_t *args, mp_map_t *kwargs
}
case QS(MP_QSTR_essid):
req_if = SOFTAP_IF;
- val = mp_obj_new_str((char*)cfg.ap.ssid, cfg.ap.ssid_len, false);
+ val = mp_obj_new_str((char*)cfg.ap.ssid, cfg.ap.ssid_len);
break;
case QS(MP_QSTR_hidden):
req_if = SOFTAP_IF;
@@ -428,7 +428,7 @@ STATIC mp_obj_t esp_config(size_t n_args, const mp_obj_t *args, mp_map_t *kwargs
case QS(MP_QSTR_dhcp_hostname): {
req_if = STATION_IF;
char* s = wifi_station_get_hostname();
- val = mp_obj_new_str(s, strlen(s), false);
+ val = mp_obj_new_str(s, strlen(s));
break;
}
default:
diff --git a/ports/esp8266/moduos.c b/ports/esp8266/moduos.c
index d0554096e..93f7aa712 100644
--- a/ports/esp8266/moduos.c
+++ b/ports/esp8266/moduos.c
@@ -60,7 +60,7 @@ STATIC mp_obj_tuple_t os_uname_info_obj = {
STATIC mp_obj_t os_uname(void) {
// We must populate the "release" field each time in case it was GC'd since the last call.
const char *ver = system_get_sdk_version();
- os_uname_info_obj.items[2] = mp_obj_new_str(ver, strlen(ver), false);
+ os_uname_info_obj.items[2] = mp_obj_new_str(ver, strlen(ver));
return (mp_obj_t)&os_uname_info_obj;
}
STATIC MP_DEFINE_CONST_FUN_OBJ_0(os_uname_obj, os_uname);