authorgravatar for git@vexu.euVeikka Tuominen <git@vexu.eu> 2024-03-17 09:06:54+02:00
committergravatar for git@vexu.euVeikka Tuominen <git@vexu.eu> 2024-03-17 09:06:54+02:00
loge6f74b78ef48bc1d23ccd98d042534f0bbe3eb80
tree6016314cc6920336bb62062e7423313bd380b24f
parentec2465542cd7bfd58f7bf72552b6f332af2c03f9

std: define error set of `toPosixPath`


2 files changed, 2 insertions(+), 2 deletions(-)

lib/std/dynamic_library.zig+1-1
...@@ -414,7 +414,7 @@ pub const WindowsDynLib = struct {...@@ -414,7 +414,7 @@ pub const WindowsDynLib = struct {
414};414};
415415
416pub const DlDynLib = struct {416pub const DlDynLib = struct {
417 pub const Error = error{FileNotFound};417 pub const Error = error{ FileNotFound, NameTooLong };
418418
419 handle: *anyopaque,419 handle: *anyopaque,
420420
lib/std/os.zig+1-1
...@@ -5979,7 +5979,7 @@ pub fn sched_getaffinity(pid: pid_t) SchedGetAffinityError!cpu_set_t {...@@ -5979,7 +5979,7 @@ pub fn sched_getaffinity(pid: pid_t) SchedGetAffinityError!cpu_set_t {
59795979
5980/// Used to convert a slice to a null terminated slice on the stack.5980/// Used to convert a slice to a null terminated slice on the stack.
5981/// TODO https://github.com/ziglang/zig/issues/2875981/// TODO https://github.com/ziglang/zig/issues/287
5982pub fn toPosixPath(file_path: []const u8) ![MAX_PATH_BYTES - 1:0]u8 {5982pub fn toPosixPath(file_path: []const u8) error{NameTooLong}![MAX_PATH_BYTES - 1:0]u8 {
5983 if (std.debug.runtime_safety) assert(std.mem.indexOfScalar(u8, file_path, 0) == null);5983 if (std.debug.runtime_safety) assert(std.mem.indexOfScalar(u8, file_path, 0) == null);
5984 var path_with_null: [MAX_PATH_BYTES - 1:0]u8 = undefined;5984 var path_with_null: [MAX_PATH_BYTES - 1:0]u8 = undefined;
5985 // >= rather than > to make room for the null byte5985 // >= rather than > to make room for the null byte