diff --git a/src/bun.js/api/glob.zig b/src/bun.js/api/glob.zig index d2be93a94116e6..b57b61c48afebc 100644 --- a/src/bun.js/api/glob.zig +++ b/src/bun.js/api/glob.zig @@ -51,10 +51,10 @@ const ScanOpts = struct { return null; }; - break :cwd_str_raw ZigString.Slice.from(duped, allocator); + break :cwd_str_raw ZigString.Slice.init(allocator, duped); } - // Conver to utf-16 + // Convert to utf-16 const utf16 = bun.strings.toUTF16AllocForReal( allocator, cwd_zig_str.slice(), @@ -67,7 +67,7 @@ const ScanOpts = struct { }; const ptr: [*]u8 = @ptrCast(utf16.ptr); - break :cwd_str_raw ZigString.Slice.from(ptr[0 .. utf16.len * 2], allocator); + break :cwd_str_raw ZigString.Slice.init(allocator, ptr[0 .. utf16.len * 2]); } // `.toSlice()` internally converts to WTF-8 diff --git a/src/bun.js/bindings/bindings.zig b/src/bun.js/bindings/bindings.zig index 369ab361de9137..22ce9217993d8c 100644 --- a/src/bun.js/bindings/bindings.zig +++ b/src/bun.js/bindings/bindings.zig @@ -432,13 +432,6 @@ pub const ZigString = extern struct { pub const byteSlice = Slice.slice; - pub fn from(input: []u8, allocator: std.mem.Allocator) Slice { - return .{ - .ptr = input.ptr, - .len = @as(u32, @truncate(input.len)), - .allocator = NullableAllocator.init(allocator), - }; - } pub fn fromUTF8NeverFree(input: []const u8) Slice { return .{ diff --git a/src/bun.js/node/types.zig b/src/bun.js/node/types.zig index aa1a247b4e52f8..7dc0946cc6e858 100644 --- a/src/bun.js/node/types.zig +++ b/src/bun.js/node/types.zig @@ -431,7 +431,7 @@ pub const StringOrBuffer = union(enum) { defer global.vm().reportExtraMemory(out.len); return .{ - .encoded_slice = JSC.ZigString.Slice.from(out, bun.default_allocator), + .encoded_slice = JSC.ZigString.Slice.init(bun.default_allocator, out), }; } diff --git a/src/install/lockfile.zig b/src/install/lockfile.zig index cbf5d5e006d9d2..602efc4aa09c0a 100644 --- a/src/install/lockfile.zig +++ b/src/install/lockfile.zig @@ -1646,7 +1646,7 @@ pub fn saveToDisk(this: *Lockfile, filename: stringZ) void { .fd = bun.toFD(file.handle), }, .dirfd = bun.invalid_fd, - .data = .{ .string = .{ .utf8 = bun.JSC.ZigString.Slice.from(bytes.items, bun.default_allocator) } }, + .data = .{ .string = .{ .utf8 = bun.JSC.ZigString.Slice.init(bun.default_allocator, bytes.items) } }, }, .sync, )) {