commit 3a5cc4da6dc41a5513e48792a63dafc26dfa654b parent 5a0d169e2f9da861b2268a41a362336a08a2b63e Author: erai <erai@omiltem.net> Date: Sat, 12 Apr 2025 10:24:56 -0400 add mkstr Diffstat:
M | lib.om | | | 8 | ++++++++ |
1 file changed, 8 insertions(+), 0 deletions(-)
diff --git a/lib.om b/lib.om @@ -538,3 +538,11 @@ func fxxd(out: *file, buf: *byte, n: int) { i = i + 16; } } + +func mkstr(a: *alloc, s: *byte, n: int): *byte { + var r: *byte; + r = alloc(a, n + 1); + memcpy(r, s, n); + r[n] = 0 as byte; + return r; +}