From e75c711c68896f5952793601f156c921c814caab Mon Sep 17 00:00:00 2001 From: Jarred Sumner Date: Thu, 30 Dec 2021 21:12:32 -0800 Subject: Upgrade to latest Zig, remove dependency on patched version of Zig (#96) * Prepare to upgrade zig * zig fmt * AllocGate * Update data_url.zig * wip * few files * just headers now? * I think everything works? * Update mimalloc * Update hash_map.zig * Perf improvements to compensate for Allocgate * Bump * :camera: * Update bun.lockb * Less branching * [js parser] Slightly reduce memory usage * Update js_parser.zig * WIP remove unused * [JS parser] WIP support for `with` keyword * Remove more dead code * Fix all the build errors! * cleanup * Move `network_thread` up * Bump peechy * Update README.md --- src/blob.zig | 23 ++++++++++++++++------- 1 file changed, 16 insertions(+), 7 deletions(-) (limited to 'src/blob.zig') diff --git a/src/blob.zig b/src/blob.zig index 9e0eba407..65679978d 100644 --- a/src/blob.zig +++ b/src/blob.zig @@ -1,6 +1,15 @@ const std = @import("std"); const Lock = @import("./lock.zig").Lock; -usingnamespace @import("./global.zig"); +const _global = @import("./global.zig"); +const string = _global.string; +const Output = _global.Output; +const Global = _global.Global; +const Environment = _global.Environment; +const strings = _global.strings; +const MutableString = _global.MutableString; +const stringZ = _global.stringZ; +const default_allocator = _global.default_allocator; +const C = _global.C; const Blob = @This(); @@ -9,10 +18,10 @@ len: usize, pub const Map = struct { const MapContext = struct { - pub fn hash(self: @This(), s: u64) u32 { + pub fn hash(_: @This(), s: u64) u32 { return @truncate(u32, s); } - pub fn eql(self: @This(), a: u64, b: u64) bool { + pub fn eql(_: @This(), a: u64, b: u64) bool { return a == b; } }; @@ -20,9 +29,9 @@ pub const Map = struct { const HashMap = std.ArrayHashMap(u64, Blob, MapContext, false); lock: Lock, map: HashMap, - allocator: *std.mem.Allocator, + allocator: std.mem.Allocator, - pub fn init(allocator: *std.mem.Allocator) Map { + pub fn init(allocator: std.mem.Allocator) Map { return Map{ .lock = Lock.init(), .map = HashMap.init(allocator), @@ -53,9 +62,9 @@ pub const Map = struct { pub const Group = struct { persistent: Map, temporary: Map, - allocator: *std.mem.Allocator, + allocator: std.mem.Allocator, - pub fn init(allocator: *std.mem.Allocator) !*Group { + pub fn init(allocator: std.mem.Allocator) !*Group { var group = try allocator.create(Group); group.* = Group{ .persistent = Map.init(allocator), .temporary = Map.init(allocator), .allocator = allocator }; return group; -- cgit v1.2.3