authorgravatar for andrew@ziglang.orgAndrew Kelley <andrew@ziglang.org> 2026-04-20 07:05:35+02:00
committergravatar for alex@alexrp.comAlex Rønne Petersen <alex@alexrp.com> 2026-04-20 22:39:46+02:00
logcf65d4f080f26f998c3d8847ee0c92887adac4c5
tree5072291ca2c3462f2f56a3fe3a16ed8b13114b49
parent2259ed213beada566113fee737285418f012302c
signaturebadge-check Signed by SSH key SHA256:7B/LJ7bpR1eX8aCXSr4mtd5M45VMPKcx9zY8e95b5QM

Merge pull request 'Fix uefi `(un)installMultipleProtocolInterfaces`' (#31934) from mrosowski/zig:uefi-fix-install-multiple into master

Reviewed-on: https://codeberg.org/ziglang/zig/pulls/31934 Reviewed-by: linus <mail@linusgroh.de>

1 files changed, 9 insertions(+), 8 deletions(-)

lib/std/os/uefi/tables/boot_services.zig+9-8
......@@ -158,12 +158,10 @@ pub const BootServices = extern struct {
158158 _locateProtocol: *const fn (protocol: *const Guid, registration: ?EventRegistration, interface: *?*const anyopaque) callconv(cc) Status,
159159
160160 /// Installs one or more protocol interfaces into the boot services environment
161 // TODO: use callconv(cc) instead once that works
162 _installMultipleProtocolInterfaces: *const fn (handle: *Handle, ...) callconv(.c) Status,
161 _installMultipleProtocolInterfaces: *const fn (handle: *?Handle, ...) callconv(cc) Status,
163162
164163 /// Removes one or more protocol interfaces into the boot services environment
165 // TODO: use callconv(cc) instead once that works
166 _uninstallMultipleProtocolInterfaces: *const fn (handle: *Handle, ...) callconv(.c) Status,
164 _uninstallMultipleProtocolInterfaces: *const fn (handle: Handle, ...) callconv(cc) Status,
167165
168166 /// Computes and returns a 32-bit CRC for a data buffer.
169167 _calculateCrc32: *const fn (data: [*]const u8, data_size: usize, *u32) callconv(cc) Status,
......@@ -1238,8 +1236,9 @@ fn protocolInterfaces(
12381236 @TypeOf(interfaces),
12391237 ) = undefined;
12401238 result[0] = handle_arg;
1239 result[result.len - 1] = null;
12411240
1242 var idx: usize = 1;
1241 comptime var idx: usize = 1;
12431242 inline for (interfaces) |interface| {
12441243 const InterfacePtr = @TypeOf(interface);
12451244 const Interface = switch (@typeInfo(InterfacePtr)) {
......@@ -1272,13 +1271,15 @@ fn ProtocolInterfaces(HandleType: type, Interfaces: type) type {
12721271 @compileError("expected tuple of protocol interfaces, got " ++ @typeName(Interfaces));
12731272 const interfaces_info = interfaces_type_info.@"struct";
12741273
1275 var tuple_types: [interfaces_info.fields.len * 2 + 1]type = undefined;
1274 var tuple_types: [interfaces_info.fields.len * 2 + 2]type = undefined;
12761275 tuple_types[0] = HandleType;
1276 tuple_types[tuple_types.len - 1] = ?*const Guid;
1277
12771278 var idx = 1;
1278 while (idx < tuple_types.len) : (idx += 2) {
1279 while (idx < tuple_types.len - 1) : (idx += 2) {
12791280 tuple_types[idx] = *const Guid;
12801281 tuple_types[idx + 1] = *const anyopaque;
12811282 }
12821283
1283 return std.meta.Tuple(tuple_types[0..]);
1284 return @Tuple(tuple_types[0..]);
12841285}