From dcf150cef279ac75294cc6618c0641fbfaf43814 Mon Sep 17 00:00:00 2001 From: dzaima Date: Sun, 15 Jun 2025 03:59:03 +0300 Subject: [PATCH] =?UTF-8?q?avoid=20unnecessarily=20copying=20=E2=80=A2FByt?= =?UTF-8?q?es=20result?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/builtins/sysfn.c | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/src/builtins/sysfn.c b/src/builtins/sysfn.c index 8290771f..cb06bea3 100644 --- a/src/builtins/sysfn.c +++ b/src/builtins/sysfn.c @@ -801,12 +801,10 @@ B fchars_c2(B d, B w, B x) { } STATIC_GLOBAL NFnDesc* fBytesDesc; B fbytes_c1(B d, B x) { - I8Arr* tf = path_bytes(path_rel(nfn_objU(d), x, "•file.Bytes")); - usz ia = PIA(tf); - u8* rp; B r = m_c8arrv(&rp, ia); - COPY_TO(rp, el_i8, 0, taga(tf), 0, ia); - ptr_dec(tf); - return r; + TyArr* tf = path_bytes(path_rel(nfn_objU(d), x, "•file.Bytes")); + assert(tf->type == t_i8arr && reusable(taga(tf))); + tf->type = t_c8arr; + return taga(tf); } B fbytes_c2(B d, B w, B x) { if (isAtm(x) || RNK(x)!=1) thrM("𝕨 •file.Bytes 𝕩: 𝕩 must be a list");