diff options
author | 2022-03-17 18:28:40 -0700 | |
---|---|---|
committer | 2022-03-17 18:28:40 -0700 | |
commit | 8526f77c70a4c23c3f5335066a07a4179fd4b4f3 (patch) | |
tree | f491dd363ddf7d5d57c81f5363e9fffbbe9395d5 | |
parent | 86a4ab704d026b984fba049c67b2e9594d0ddf65 (diff) | |
download | bun-8526f77c70a4c23c3f5335066a07a4179fd4b4f3.tar.gz bun-8526f77c70a4c23c3f5335066a07a4179fd4b4f3.tar.zst bun-8526f77c70a4c23c3f5335066a07a4179fd4b4f3.zip |
Update lockfile.zig
-rw-r--r-- | src/install/lockfile.zig | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/src/install/lockfile.zig b/src/install/lockfile.zig index 30b1b10b0..63274cc43 100644 --- a/src/install/lockfile.zig +++ b/src/install/lockfile.zig @@ -2603,6 +2603,14 @@ pub const Package = extern struct { }; }; +pub fn deinit(this: *Lockfile) void { + this.buffers.deinit(this.allocator); + this.packages.deinit(this.allocator); + this.unique_packages.deinit(this.allocator); + this.string_pool.deinit(); + this.* = undefined; +} + const Buffers = struct { trees: Tree.List = Tree.List{}, hoisted_packages: PackageIDList = PackageIDList{}, @@ -2613,6 +2621,14 @@ const Buffers = struct { // node_modules_package_ids: PackageIDList = PackageIDList{}, string_bytes: StringBuffer = StringBuffer{}, + pub fn deinit(this: *Buffers, allocator: std.mem.Allocator) void { + try this.trees.deinit(allocator); + try this.resolutions.deinit(allocator); + try this.dependencies.deinit(allocator); + try this.extern_strings.deinit(allocator); + try this.string_bytes.deinit(allocator); + } + pub fn preallocate(this: *Buffers, that: Buffers, allocator: std.mem.Allocator) !void { try this.trees.ensureTotalCapacity(allocator, that.trees.items.len); try this.resolutions.ensureTotalCapacity(allocator, that.resolutions.items.len); |