mirror of
https://github.com/ghostty-org/ghostty.git
synced 2026-06-02 09:58:09 +00:00
style: use decl literals
This commit changes a LOT of areas of the code to use decl literals instead of redundantly referring to the type. These changes were mostly driven by some regex searches and then manual adjustment on a case-by-case basis. I almost certainly missed quite a few places where decl literals could be used, but this is a good first step in converting things, and other instances can be addressed when they're discovered. I tested GLFW+Metal and building the framework on macOS and tested a GTK build on Linux, so I'm 99% sure I didn't introduce any syntax errors or other problems with this. (fingers crossed)
This commit is contained in:
@@ -403,7 +403,7 @@ test "BitmapAllocator alloc sequentially" {
|
||||
const buf = try alloc.alignedAlloc(u8, Alloc.base_align, layout.total_size);
|
||||
defer alloc.free(buf);
|
||||
|
||||
var bm = Alloc.init(OffsetBuf.init(buf), layout);
|
||||
var bm = Alloc.init(.init(buf), layout);
|
||||
const ptr = try bm.alloc(u8, buf, 1);
|
||||
ptr[0] = 'A';
|
||||
|
||||
@@ -429,7 +429,7 @@ test "BitmapAllocator alloc non-byte" {
|
||||
const buf = try alloc.alignedAlloc(u8, Alloc.base_align, layout.total_size);
|
||||
defer alloc.free(buf);
|
||||
|
||||
var bm = Alloc.init(OffsetBuf.init(buf), layout);
|
||||
var bm = Alloc.init(.init(buf), layout);
|
||||
const ptr = try bm.alloc(u21, buf, 1);
|
||||
ptr[0] = 'A';
|
||||
|
||||
@@ -453,7 +453,7 @@ test "BitmapAllocator alloc non-byte multi-chunk" {
|
||||
const buf = try alloc.alignedAlloc(u8, Alloc.base_align, layout.total_size);
|
||||
defer alloc.free(buf);
|
||||
|
||||
var bm = Alloc.init(OffsetBuf.init(buf), layout);
|
||||
var bm = Alloc.init(.init(buf), layout);
|
||||
const ptr = try bm.alloc(u21, buf, 6);
|
||||
try testing.expectEqual(@as(usize, 6), ptr.len);
|
||||
for (ptr) |*v| v.* = 'A';
|
||||
@@ -478,7 +478,7 @@ test "BitmapAllocator alloc large" {
|
||||
const buf = try alloc.alignedAlloc(u8, Alloc.base_align, layout.total_size);
|
||||
defer alloc.free(buf);
|
||||
|
||||
var bm = Alloc.init(OffsetBuf.init(buf), layout);
|
||||
var bm = Alloc.init(.init(buf), layout);
|
||||
const ptr = try bm.alloc(u8, buf, 129);
|
||||
ptr[0] = 'A';
|
||||
bm.free(buf, ptr);
|
||||
|
||||
Reference in New Issue
Block a user