~sircmpwn/hare

d1e0a02360f42a5f664c984d112673c0e6eef447 — Sebastian 3 months ago 4ec162a
strings: remove pre-allocation

The slice's length will be less than len(s) if the string isn't ASCII.

Signed-off-by: Sebastian <sebastian@sebsite.pw>
1 files changed, 1 insertions(+), 1 deletions(-)

M strings/runes.ha
M strings/runes.ha => strings/runes.ha +1 -1
@@ 6,7 6,7 @@ use encoding::utf8;
// Returns a slice of runes for a string in O(n). The caller must free the
// return value.
export fn torunes(s: str) []rune = {
	let sl: []rune = alloc([], len(s));
	let sl: []rune = [];
	let iter = iter(s);
	for (true) {
		match (next(&iter)) {