Skip to content

Commit 1d6bc68

Browse files
committed
lib: remove cutPrefix implementation
We can use std.mem.cutPrefix directly now that we're on Zig 0.16.
1 parent 8eecb8f commit 1d6bc68

4 files changed

Lines changed: 5 additions & 23 deletions

File tree

src/apprt/gtk/class/application.zig

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,6 @@ const xev = global.xev;
2626
const Binding = @import("../../../input.zig").Binding;
2727
const CoreConfig = configpkg.Config;
2828
const CoreSurface = @import("../../../Surface.zig");
29-
const lib = @import("../../../lib/main.zig");
3029

3130
const ext = @import("../ext.zig");
3231
const key = @import("../key.zig");
@@ -1865,7 +1864,7 @@ pub const Application = extern struct {
18651864
continue;
18661865
}
18671866

1868-
if (lib.cutPrefix(u8, str, "--command=")) |v| {
1867+
if (std.mem.cutPrefix(u8, str, "--command=")) |v| {
18691868
var cmd: configpkg.Command = undefined;
18701869
cmd.parseCLI(alloc, v) catch |err| {
18711870
log.warn("unable to parse command: {t}", .{err});
@@ -1874,14 +1873,14 @@ pub const Application = extern struct {
18741873
command = cmd;
18751874
continue;
18761875
}
1877-
if (lib.cutPrefix(u8, str, "--working-directory=")) |v| {
1876+
if (std.mem.cutPrefix(u8, str, "--working-directory=")) |v| {
18781877
working_directory = alloc.dupeZ(u8, std.mem.trim(u8, v, &std.ascii.whitespace)) catch |err| wd: {
18791878
log.warn("unable to duplicate working directory: {t}", .{err});
18801879
break :wd null;
18811880
};
18821881
continue;
18831882
}
1884-
if (lib.cutPrefix(u8, str, "--title=")) |v| {
1883+
if (std.mem.cutPrefix(u8, str, "--title=")) |v| {
18851884
title = alloc.dupeZ(u8, std.mem.trim(u8, v, &std.ascii.whitespace)) catch |err| t: {
18861885
log.warn("unable to duplicate title: {t}", .{err});
18871886
break :t null;

src/cli/new_window.zig

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@ const Action = @import("../cli.zig").ghostty.Action;
55
const apprt = @import("../apprt.zig");
66
const args = @import("args.zig");
77
const diagnostics = @import("diagnostics.zig");
8-
const lib = @import("../lib/main.zig");
98
const homedir = @import("../os/homedir.zig");
109
const global = @import("../global.zig");
1110

@@ -70,12 +69,12 @@ pub const Options = struct {
7069
Allocator.Error;
7170

7271
fn checkArg(self: *Options, alloc: Allocator, arg: []const u8) CheckArgError!?[:0]const u8 {
73-
if (lib.cutPrefix(u8, arg, "--class=")) |rest| {
72+
if (std.mem.cutPrefix(u8, arg, "--class=")) |rest| {
7473
self.class = try alloc.dupeZ(u8, std.mem.trim(u8, rest, &std.ascii.whitespace));
7574
return null;
7675
}
7776

78-
if (lib.cutPrefix(u8, arg, "--working-directory=")) |rest| {
77+
if (std.mem.cutPrefix(u8, arg, "--working-directory=")) |rest| {
7978
const stripped = std.mem.trim(u8, rest, &std.ascii.whitespace);
8079
if (std.mem.eql(u8, stripped, "home")) return try alloc.dupeZ(u8, arg);
8180
if (std.mem.eql(u8, stripped, "inherit")) return try alloc.dupeZ(u8, arg);

src/lib/main.zig

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,6 @@ pub const Struct = structpkg.Struct;
1313
pub const structSizedFieldFits = structpkg.sizedFieldFits;
1414
pub const Target = @import("target.zig").Target;
1515
pub const TaggedUnion = unionpkg.TaggedUnion;
16-
pub const cutPrefix = @import("string.zig").cutPrefix;
1716

1817
test {
1918
std.testing.refAllDecls(@This());

src/lib/string.zig

Lines changed: 0 additions & 15 deletions
This file was deleted.

0 commit comments

Comments
 (0)