From 668785a82aa8479cf0d8212a66a9b656be17010b Mon Sep 17 00:00:00 2001 From: Sebastian Date: Mon, 27 Nov 2023 01:18:07 -0500 Subject: [PATCH] strings: use static append where applicable Signed-off-by: Sebastian --- strings/concat.ha | 10 +++++----- strings/dup.ha | 2 +- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/strings/concat.ha b/strings/concat.ha index 9a8f9b68..74805d13 100644 --- a/strings/concat.ha +++ b/strings/concat.ha @@ -9,9 +9,9 @@ export fn concat(strs: str...) str = { }; let new: []u8 = alloc([], z); for (let i = 0z; i < len(strs); i += 1) { - append(new, toutf8(strs[i])...); + static append(new, toutf8(strs[i])...); }; - return fromutf8_unsafe(new[..z]); + return fromutf8_unsafe(new); }; @test fn concat() void = { @@ -48,12 +48,12 @@ export fn join(delim: str, strs: str...) str = { }; let new: []u8 = alloc([], z); for (let i = 0z; i < len(strs); i += 1) { - append(new, toutf8(strs[i])...); + static append(new, toutf8(strs[i])...); if (i + 1 < len(strs)) { - append(new, toutf8(delim)...); + static append(new, toutf8(delim)...); }; }; - return fromutf8_unsafe(new[..z]); + return fromutf8_unsafe(new); }; @test fn join() void = { diff --git a/strings/dup.ha b/strings/dup.ha index d336e59b..08ef940d 100644 --- a/strings/dup.ha +++ b/strings/dup.ha @@ -26,7 +26,7 @@ export fn dup(s: const str) str = { export fn dupall(s: []str) []str = { let newsl: []str = alloc([], len(s)); for (let i = 0z; i < len(s); i += 1) { - append(newsl, dup(s[i])); + static append(newsl, dup(s[i])); }; return newsl; }; -- 2.45.2