mirror of
https://code.blicky.net/yorhel/ncdu.git
synced 2026-11-03 21:49:42 -09:00
Zig 0.16: trim start/end
This commit is contained in:
parent
e4b3c4d4c2
commit
dfffa681c1
2 changed files with 2 additions and 2 deletions
|
|
@ -55,7 +55,7 @@ const Pattern = struct {
|
|||
}
|
||||
|
||||
fn parse(pat_: []const u8) *const Pattern {
|
||||
var pat = std.mem.trimLeft(u8, pat_, "/");
|
||||
var pat = std.mem.trimStart(u8, pat_, "/");
|
||||
const top = main.allocator.create(Pattern) catch unreachable;
|
||||
var tail = top;
|
||||
tail.sub = null;
|
||||
|
|
|
|||
|
|
@ -193,7 +193,7 @@ pub fn expanduser(path: []const u8, alloc: std.mem.Allocator, environ_map: *std.
|
|||
break :blk std.mem.span(p);
|
||||
return alloc.dupeZ(u8, path);
|
||||
};
|
||||
const home = std.mem.trimRight(u8, home_raw, "/");
|
||||
const home = std.mem.trimEnd(u8, home_raw, "/");
|
||||
|
||||
if (home.len == 0 and path.len == len) return alloc.dupeZ(u8, "/");
|
||||
return try std.mem.concatWithSentinel(alloc, u8, &.{ home, path[len..] }, 0);
|
||||
|
|
|
|||
Loading…
Reference in a new issue