mirror of
https://github.com/ziglang/zig.git
synced 2024-11-24 13:20:14 +00:00
Compare commits
3 Commits
a9799ce755
...
43b11ccbee
Author | SHA1 | Date | |
---|---|---|---|
|
43b11ccbee | ||
|
f845fa04a0 | ||
|
99d812cfd2 |
@ -48,7 +48,8 @@ fn read(ma: *MemoryAccessor, address: usize, buf: []u8) bool {
|
||||
switch (linux.E.init(bytes_read)) {
|
||||
.SUCCESS => return bytes_read == buf.len,
|
||||
.FAULT => return false,
|
||||
.INVAL, .PERM, .SRCH => unreachable, // own pid is always valid
|
||||
.INVAL, .SRCH => unreachable, // own pid is always valid
|
||||
.PERM => {}, // Known to happen in containers.
|
||||
.NOMEM => {},
|
||||
.NOSYS => {}, // QEMU is known not to implement this syscall.
|
||||
else => unreachable, // unexpected
|
||||
|
@ -301,8 +301,9 @@ pub fn reallocAdvanced(
|
||||
return mem.bytesAsSlice(T, new_bytes);
|
||||
}
|
||||
|
||||
/// Free an array allocated with `alloc`. To free a single item,
|
||||
/// see `destroy`.
|
||||
/// Free an array allocated with `alloc`.
|
||||
/// If memory has length 0, free is a no-op.
|
||||
/// To free a single item, see `destroy`.
|
||||
pub fn free(self: Allocator, memory: anytype) void {
|
||||
const Slice = @typeInfo(@TypeOf(memory)).pointer;
|
||||
const bytes = mem.sliceAsBytes(memory);
|
||||
|
Loading…
Reference in New Issue
Block a user