mirror of
https://github.com/ghostty-org/ghostty.git
synced 2025-07-16 16:56:09 +03:00
terminal/new: remove more functions
This commit is contained in:
@ -39,6 +39,8 @@ const mem = std.mem;
|
||||
const Allocator = mem.Allocator;
|
||||
const Wyhash = std.hash.Wyhash;
|
||||
|
||||
const Offset = @import("size.zig").Offset;
|
||||
|
||||
pub fn AutoHashMapUnmanaged(comptime K: type, comptime V: type) type {
|
||||
return HashMapUnmanaged(K, V, AutoContext(K), default_max_load_percentage);
|
||||
}
|
||||
@ -247,10 +249,6 @@ pub fn HashMapUnmanaged(
|
||||
found_existing: bool,
|
||||
};
|
||||
|
||||
fn isUnderMaxLoadPercentage(size: Size, cap: Size) bool {
|
||||
return size * 100 < max_load_percentage * cap;
|
||||
}
|
||||
|
||||
/// Initialize a hash map with a given capacity and a buffer. The
|
||||
/// buffer must fit within the size defined by `layoutForCapacity`.
|
||||
pub fn init(new_capacity: Size, buf: []u8) Self {
|
||||
@ -815,14 +813,6 @@ pub fn HashMapUnmanaged(
|
||||
@memset(@as([*]u8, @ptrCast(self.metadata.?))[0 .. @sizeOf(Metadata) * self.capacity()], 0);
|
||||
}
|
||||
|
||||
// This counts the number of occupied slots (not counting tombstones), which is
|
||||
// what has to stay under the max_load_percentage of capacity.
|
||||
fn load(self: *const Self) Size {
|
||||
const max_load = (self.capacity() * max_load_percentage) / 100;
|
||||
assert(max_load >= self.available);
|
||||
return @as(Size, @truncate(max_load - self.available));
|
||||
}
|
||||
|
||||
fn growIfNeeded2(self: *Self, new_count: Size) Allocator.Error!void {
|
||||
if (new_count > self.available) return error.OutOfMemory;
|
||||
}
|
||||
|
Reference in New Issue
Block a user