summaryrefslogtreecommitdiff
path: root/py/objstr.c
diff options
context:
space:
mode:
authorDan Halbert <halbert@halwitz.org>2019-09-04 00:12:09 -0400
committerDan Halbert <halbert@halwitz.org>2019-09-04 00:12:09 -0400
commit95a5a57f949c2f00caa144d246ce2a5477fb7c6d (patch)
treeab13631e2ed8dd1c74d257930d54b88d40178461 /py/objstr.c
parentd3cb1030c8c8ab1395c17db1ec003e062c6a42a9 (diff)
parent321835cb4764e40d290635ba16a849aad6463f8d (diff)
Merge remote-tracking branch 'adafruit/master' into choose-usb-devices-xac
Diffstat (limited to 'py/objstr.c')
-rw-r--r--py/objstr.c8
1 files changed, 8 insertions, 0 deletions
diff --git a/py/objstr.c b/py/objstr.c
index afe11f00f..6ef9a15b5 100644
--- a/py/objstr.c
+++ b/py/objstr.c
@@ -2094,6 +2094,14 @@ mp_obj_t mp_obj_new_bytes(const byte* data, size_t len) {
return mp_obj_new_str_copy(&mp_type_bytes, data, len);
}
+mp_obj_t mp_obj_new_bytes_of_zeros(size_t len) {
+ vstr_t vstr;
+ vstr_init_len(&vstr, len);
+ memset(vstr.buf, 0, len);
+ return mp_obj_new_str_from_vstr(&mp_type_bytes, &vstr);
+}
+
+
bool mp_obj_str_equal(mp_obj_t s1, mp_obj_t s2) {
if (MP_OBJ_IS_QSTR(s1) && MP_OBJ_IS_QSTR(s2)) {
return s1 == s2;