vstr: Restore bytestr compatibility.
diff --git a/py/vstr.c b/py/vstr.c
index 2dbc6f0..9ccc95d 100644
--- a/py/vstr.c
+++ b/py/vstr.c
@@ -199,6 +199,7 @@
}
void vstr_add_char(vstr_t *vstr, unichar c) {
+#if MICROPY_PY_BUILTINS_STR_UNICODE
// TODO: Can this be simplified and deduplicated?
// Is it worth just calling vstr_add_len(vstr, 4)?
if (c < 0x80) {
@@ -233,6 +234,13 @@
buf[2] = ((c >> 6) & 0x3F) | 0x80;
buf[3] = (c & 0x3F) | 0x80;
}
+#else
+ byte *buf = (byte*)vstr_add_len(vstr, 1);
+ if (buf == NULL) {
+ return;
+ }
+ buf[0] = c;
+#endif
}
void vstr_add_str(vstr_t *vstr, const char *str) {