| author | |
| committer | |
| log | 3090f83800f936118dfd4145a5e5754b8e899f23 |
| tree | 7987d51ccc44e43a1fb54072b63461ff177d518b |
| parent | f4606842d26d2de72a1fcfad26a22b32c9cf7a53 |
2 files changed, 5 insertions(+), 4 deletions(-)
std/event/io.zig+4-2| ... | ... | @@ -53,10 +53,12 @@ pub fn InStream(comptime ReadError: type) type { |
| 53 | 53 | return mem.readInt(bytes, T, endian); |
| 54 | 54 | } |
| 55 | 55 | |
| 56 | pub async fn readStruct(self: *Self, comptime T: type, ptr: *T) !void { | |
| 56 | pub async fn readStruct(self: *Self, comptime T: type) !T { | |
| 57 | 57 | // Only extern and packed structs have defined in-memory layout. |
| 58 | 58 | comptime assert(@typeInfo(T).Struct.layout != builtin.TypeInfo.ContainerLayout.Auto); |
| 59 | return await (async self.readNoEof(@sliceToBytes((*[1]T)(ptr)[0..])) catch unreachable); | |
| 59 | var res: [1]T = undefined; | |
| 60 | try await (async self.readNoEof(@sliceToBytes(res[0..])) catch unreachable); | |
| 61 | return res[0]; | |
| 60 | 62 | } |
| 61 | 63 | }; |
| 62 | 64 | } |
std/pdb.zig+1-2| ... | ... | @@ -485,8 +485,7 @@ const Msf = struct { |
| 485 | 485 | var file_stream = file.inStream(); |
| 486 | 486 | const in = &file_stream.stream; |
| 487 | 487 | |
| 488 | var superblock: SuperBlock = undefined; | |
| 489 | try in.readStruct(SuperBlock, &superblock); | |
| 488 | const superblock = try in.readStruct(SuperBlock); | |
| 490 | 489 | |
| 491 | 490 | if (!mem.eql(u8, superblock.FileMagic, SuperBlock.file_magic)) |
| 492 | 491 | return error.InvalidDebugInfo; |