ref: 30e4700f5d0ce493c71289ce53bac2fb18c4664d
dir: /libstd/strjoin.myr/
use "alloc.use" use "die.use" use "slcp.use" pkg std = const strcat : (a : byte[:], b : byte[:] -> byte[:]) const strjoin : (strings : byte[:][:] -> byte[:]) ;; const strcat = {a, b -> strjoin([a, b][:]) } const strjoin = {strings var len, off var i var s len = 0 for i = 0; i < strings.len; i++ len += strings[i].len ;; s = slalloc(len) off = 0 for i = 0; i < strings.len; i++ slcp(s[off:off + strings[i].len], strings[i]) off += strings[i].len ;; -> s }