aboutsummaryrefslogtreecommitdiff
path: root/src/blob.zig
diff options
context:
space:
mode:
authorGravatar Jarred Sumner <jarred@jarredsumner.com> 2021-12-30 21:12:32 -0800
committerGravatar GitHub <noreply@github.com> 2021-12-30 21:12:32 -0800
commite75c711c68896f5952793601f156c921c814caab (patch)
treef3b30e2281c7231d480bb84503d17b2370866ff9 /src/blob.zig
parent8d031f13c0e04629d431176e211a31224b7618c0 (diff)
downloadbun-e75c711c68896f5952793601f156c921c814caab.tar.gz
bun-e75c711c68896f5952793601f156c921c814caab.tar.zst
bun-e75c711c68896f5952793601f156c921c814caab.zip
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
Diffstat (limited to 'src/blob.zig')
-rw-r--r--src/blob.zig23
1 files changed, 16 insertions, 7 deletions
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;