mirror of
https://github.com/ghostty-org/ghostty.git
synced 2025-07-16 00:36:07 +03:00
terminal: RefCountedSet doesn't need to pass base anymore
This commit is contained in:
@ -270,7 +270,7 @@ pub fn RefCountedSet(
|
|||||||
self.living += 1;
|
self.living += 1;
|
||||||
|
|
||||||
return if (added_id == id) null else added_id;
|
return if (added_id == id) null else added_id;
|
||||||
} else if (ctx.eql(base, value, items[id].value)) {
|
} else if (ctx.eql(value, items[id].value)) {
|
||||||
items[id].meta.ref += 1;
|
items[id].meta.ref += 1;
|
||||||
|
|
||||||
return null;
|
return null;
|
||||||
@ -396,7 +396,7 @@ pub fn RefCountedSet(
|
|||||||
if (comptime @hasDecl(Context, "deleted")) {
|
if (comptime @hasDecl(Context, "deleted")) {
|
||||||
// Inform the context struct that we're
|
// Inform the context struct that we're
|
||||||
// deleting the dead item's value for good.
|
// deleting the dead item's value for good.
|
||||||
ctx.deleted(base, item.value);
|
ctx.deleted(item.value);
|
||||||
}
|
}
|
||||||
|
|
||||||
self.psl_stats[item.meta.psl] -= 1;
|
self.psl_stats[item.meta.psl] -= 1;
|
||||||
@ -429,7 +429,7 @@ pub fn RefCountedSet(
|
|||||||
const table = self.table.ptr(base);
|
const table = self.table.ptr(base);
|
||||||
const items = self.items.ptr(base);
|
const items = self.items.ptr(base);
|
||||||
|
|
||||||
const hash: u64 = ctx.hash(base, value);
|
const hash: u64 = ctx.hash(value);
|
||||||
|
|
||||||
for (0..self.max_psl + 1) |i| {
|
for (0..self.max_psl + 1) |i| {
|
||||||
const p: usize = @intCast((hash + i) & self.layout.table_mask);
|
const p: usize = @intCast((hash + i) & self.layout.table_mask);
|
||||||
@ -461,7 +461,7 @@ pub fn RefCountedSet(
|
|||||||
// If the item is a part of the same probe sequence,
|
// If the item is a part of the same probe sequence,
|
||||||
// we check if it matches the value we're looking for.
|
// we check if it matches the value we're looking for.
|
||||||
if (item.meta.psl == i and
|
if (item.meta.psl == i and
|
||||||
ctx.eql(base, value, item.value))
|
ctx.eql(value, item.value))
|
||||||
{
|
{
|
||||||
return id;
|
return id;
|
||||||
}
|
}
|
||||||
@ -487,7 +487,7 @@ pub fn RefCountedSet(
|
|||||||
.meta = .{ .psl = 0, .ref = 0 },
|
.meta = .{ .psl = 0, .ref = 0 },
|
||||||
};
|
};
|
||||||
|
|
||||||
const hash: u64 = ctx.hash(base, value);
|
const hash: u64 = ctx.hash(value);
|
||||||
|
|
||||||
var held_id: Id = new_id;
|
var held_id: Id = new_id;
|
||||||
var held_item: *Item = &new_item;
|
var held_item: *Item = &new_item;
|
||||||
@ -516,7 +516,7 @@ pub fn RefCountedSet(
|
|||||||
if (comptime @hasDecl(Context, "deleted")) {
|
if (comptime @hasDecl(Context, "deleted")) {
|
||||||
// Inform the context struct that we're
|
// Inform the context struct that we're
|
||||||
// deleting the dead item's value for good.
|
// deleting the dead item's value for good.
|
||||||
ctx.deleted(base, item.value);
|
ctx.deleted(item.value);
|
||||||
}
|
}
|
||||||
|
|
||||||
chosen_id = id;
|
chosen_id = id;
|
||||||
|
@ -247,15 +247,13 @@ pub const Set = RefCountedSet(
|
|||||||
Id,
|
Id,
|
||||||
size.CellCountInt,
|
size.CellCountInt,
|
||||||
struct {
|
struct {
|
||||||
pub fn hash(self: *const @This(), base: anytype, style: Style) u64 {
|
pub fn hash(self: *const @This(), style: Style) u64 {
|
||||||
_ = self;
|
_ = self;
|
||||||
_ = base;
|
|
||||||
return style.hash();
|
return style.hash();
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn eql(self: *const @This(), base: anytype, a: Style, b: Style) bool {
|
pub fn eql(self: *const @This(), a: Style, b: Style) bool {
|
||||||
_ = self;
|
_ = self;
|
||||||
_ = base;
|
|
||||||
return a.eql(b);
|
return a.eql(b);
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
Reference in New Issue
Block a user