From e2a17344dc543c9c652cfe2b14cd2709dd6cfd22 Mon Sep 17 00:00:00 2001 From: Jarred Sumner Date: Mon, 28 Aug 2023 04:39:16 -0700 Subject: just kernel32 things (#4354) * just kernel32 things * more * Update linux_c.zig * Update windows_c.zig * Add workaround Workaround https://github.com/ziglang/zig/issues/16980 * Rename http.zig to bun_dev_http_server.zig * Rename usages * more * more * more * thanks tigerbeetle * Rename `JSC.Node.Syscall` -> `bun.sys` * more * woops * more! * hmm * it says there are only 37 errors, but that's not true * populate argv * it says 32 errors! * 24 errors * fix regular build * 12 left! * Still 12 left! * more * 2 errors left... * 1 more error * Add link to Tigerbeetle * Fix the remainign error * Fix test timeout * Update syscall.zig --------- Co-authored-by: Jarred Sumner <709451+Jarred-Sumner@users.noreply.github.com> --- src/string_builder.zig | 12 ++++++++++++ 1 file changed, 12 insertions(+) (limited to 'src/string_builder.zig') diff --git a/src/string_builder.zig b/src/string_builder.zig index 8acef5f07..2111ffa1a 100644 --- a/src/string_builder.zig +++ b/src/string_builder.zig @@ -38,6 +38,18 @@ pub fn deinit(this: *StringBuilder, allocator: Allocator) void { allocator.free(this.ptr.?[0..this.cap]); } +pub fn append16(this: *StringBuilder, slice: []const u16) ?[:0]u8 { + var buf = this.writable(); + const result = bun.simdutf.convert.utf16.to.utf8.with_errors.le(slice, buf); + if (result.status == .success) { + this.len += result.count + 1; + buf[result.count] = 0; + return buf[0..result.count :0]; + } + + return null; +} + pub fn append(this: *StringBuilder, slice: string) string { if (comptime Environment.allow_assert) { assert(this.len <= this.cap); // didn't count everything -- cgit v1.2.3