mirror of
https://github.com/oven-sh/bun
synced 2026-02-09 10:28:47 +00:00
chore: Mutable deinitializers (#23876)
This commit is contained in:
@@ -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;
|
||||
|
||||
@@ -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();
|
||||
|
||||
@@ -21,7 +21,7 @@ pub const FileCopier = struct {
|
||||
};
|
||||
}
|
||||
|
||||
pub fn deinit(this: *const FileCopier) void {
|
||||
pub fn deinit(this: *FileCopier) void {
|
||||
this.walker.deinit();
|
||||
}
|
||||
|
||||
|
||||
@@ -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(),
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
|
||||
|
||||
@@ -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) {
|
||||
|
||||
Reference in New Issue
Block a user