authorgravatar for jsentity@noreply.codeberg.orgjsentity <jsentity@noreply.codeberg.org> 2026-01-26 11:41:22+01:00
committergravatar for mail@linusgroh.delinus <mail@linusgroh.de> 2026-01-26 11:41:22+01:00
logb4c86c850d5fa6c0944549cd0209b333f9f6b004
tree956cca4d02dee64e34de5d31239df069cf4626cb
parentf186809caf3a14cbfbe6778f946c8597ebe7d561

Fix std.uefi.protocol.DevicePath.next() and add utility function isEnd() (#30887)

Fix for https://codeberg.org/ziglang/zig/issues/30884 and https://codeberg.org/ziglang/zig/issues/30885 Co-authored-by: jsentity <jsentity@noreply.codeberg.org> Co-committed-by: jsentity <jsentity@noreply.codeberg.org>

1 files changed, 3 insertions(+), 5 deletions(-)

lib/std/os/uefi/protocol/device_path.zig+3-5
......@@ -26,12 +26,10 @@ pub const DevicePath = extern struct {
2626
2727 /// Returns the next DevicePath node in the sequence, if any.
2828 pub fn next(self: *const DevicePath) ?*const DevicePath {
29 const subtype: uefi.DevicePath.End.Subtype = @enumFromInt(self.subtype);
30 if (self.type == .end and subtype == .end_entire) return null;
2931 const bytes: [*]const u8 = @ptrCast(self);
30 const next_node: *const DevicePath = @ptrCast(bytes + self.length);
31 if (next_node.type == .end and @as(uefi.DevicePath.End.Subtype, @enumFromInt(next_node.subtype)) == .end_entire)
32 return null;
33
34 return next_node;
32 return @ptrCast(bytes + self.length);
3533 }
3634
3735 /// Calculates the total length of the device path structure in bytes, including the end of device path node.