change string([]byte) to pass array, rather than &a[0],
to string convert. if the byte array has length 0,
the computation of &a[0] throws an index bounds error.
for fixed size arrays, this ends up invoking arrays2d
unnecessarily, but it works.
R=ken
DELTA=304 (44 added, 28 deleted, 232 changed)
OCL=15674
CL=15678
diff --git a/src/runtime/string.c b/src/runtime/string.c
index 27a7581..fec66f8 100644
--- a/src/runtime/string.c
+++ b/src/runtime/string.c
@@ -164,3 +164,12 @@
mcpy(s->str, a, l);
FLUSH(&s);
}
+
+void
+sys·arraystring(Array *b, string s)
+{
+ s = mal(sizeof(s->len)+b->nel);
+ s->len = b->nel;
+ mcpy(s->str, b->array, s->len);
+ FLUSH(&s);
+}