chore: Mutable deinitializers (#23876)

This commit is contained in:
Marko Vejnovic
2025-10-20 20:39:46 -07:00
committed by GitHub
parent 3e53ada574
commit 07317193fe
6 changed files with 9 additions and 9 deletions

View File

@@ -361,7 +361,7 @@ pub fn BSSStringList(comptime _count: usize, comptime _item_length: usize) type
return instance;
}
pub fn deinit(self: *const Self) void {
pub fn deinit(self: *Self) void {
_ = self;
bun.default_allocator.destroy(instance);
loaded = false;

View File

@@ -735,7 +735,7 @@ pub const ConfigIterator = struct {
try writer.print("//{s}:{s}={s}", .{ this.registry_url, @tagName(this.optname), this.value });
}
pub fn deinit(self: *const Item, allocator: Allocator) void {
pub fn deinit(self: *Item, allocator: Allocator) void {
allocator.free(self.registry_url);
allocator.free(self.value);
}
@@ -869,7 +869,7 @@ pub fn loadNpmrcConfig(
// to be created at the end.
var configs = std.ArrayList(ConfigIterator.Item).init(allocator);
defer {
for (configs.items) |item| {
for (configs.items) |*item| {
item.deinit(allocator);
}
configs.deinit();

View File

@@ -21,7 +21,7 @@ pub const FileCopier = struct {
};
}
pub fn deinit(this: *const FileCopier) void {
pub fn deinit(this: *FileCopier) void {
this.walker.deinit();
}

View File

@@ -1769,9 +1769,9 @@ pub fn Parser(comptime enc: Encoding) type {
line_indent: Indent,
multiline: bool = false,
pub fn done(ctx: *const @This()) Token(enc) {
pub fn done(ctx: *@This()) Token(enc) {
const scalar: Token(enc).Scalar = scalar: {
const scalar_str = ctx.str_builder.done();
var scalar_str = ctx.str_builder.done();
if (ctx.scalar) |scalar| {
if (scalar_str.len() == ctx.resolved_scalar_len) {
@@ -4530,7 +4530,7 @@ pub fn Parser(comptime enc: Encoding) type {
};
}
pub fn deinit(self: *const @This()) void {
pub fn deinit(self: *@This()) void {
switch (self.*) {
.range => {},
.list => |*list| list.deinit(),

View File

@@ -58,7 +58,7 @@ pub const Entry = struct {
pub const Queue = std.fifo.LinearFifo(Entry, .Dynamic);
pub fn deinit(self: *const @This(), allocator: std.mem.Allocator) void {
pub fn deinit(self: *@This(), allocator: std.mem.Allocator) void {
allocator.free(self.serialized_data);
}

View File

@@ -109,7 +109,7 @@ pub fn next(self: *Walker) bun.sys.Maybe(?WalkerEntry) {
return .initResult(null);
}
pub fn deinit(self: *const Walker) void {
pub fn deinit(self: *Walker) void {
if (self.stack.items.len > 0) {
for (self.stack.items[1..]) |*item| {
if (self.stack.items.len != 0) {