zig fmt
parent
6bd8610063
commit
e891f9cd9d
|
@ -116,7 +116,7 @@ fn startPuts(ctx: *Context) u8 {
|
|||
const x = @bitCast(i32, r.random.scalar(u32));
|
||||
const node = ctx.allocator.create(Queue(i32).Node{
|
||||
.next = null,
|
||||
.data = x
|
||||
.data = x,
|
||||
}) catch unreachable;
|
||||
ctx.queue.put(node);
|
||||
_ = @atomicRmw(isize, &ctx.put_sum, builtin.AtomicRmwOp.Add, x, AtomicOrder.SeqCst);
|
||||
|
|
|
@ -119,7 +119,7 @@ fn startPuts(ctx: *Context) u8 {
|
|||
const x = @bitCast(i32, r.random.scalar(u32));
|
||||
const node = ctx.allocator.create(Stack(i32).Node{
|
||||
.next = null,
|
||||
.data = x
|
||||
.data = x,
|
||||
}) catch unreachable;
|
||||
ctx.stack.push(node);
|
||||
_ = @atomicRmw(isize, &ctx.put_sum, builtin.AtomicRmwOp.Add, x, AtomicOrder.SeqCst);
|
||||
|
|
|
@ -279,9 +279,7 @@ pub fn openSelfDebugInfo(allocator: *mem.Allocator) !*ElfStackTrace {
|
|||
var exe_file = try os.openSelfExe();
|
||||
defer exe_file.close();
|
||||
|
||||
const st = try allocator.create(ElfStackTrace{
|
||||
.symbol_table = try macho.loadSymbols(allocator, &io.FileInStream.init(&exe_file))
|
||||
});
|
||||
const st = try allocator.create(ElfStackTrace{ .symbol_table = try macho.loadSymbols(allocator, &io.FileInStream.init(&exe_file)) });
|
||||
errdefer allocator.destroy(st);
|
||||
return st;
|
||||
},
|
||||
|
@ -972,7 +970,7 @@ fn scanAllCompileUnits(st: *ElfStackTrace) !void {
|
|||
|
||||
try st.self_exe_file.seekTo(compile_unit_pos);
|
||||
|
||||
const compile_unit_die = try st.allocator().create( try parseDie(st, abbrev_table, is_64) );
|
||||
const compile_unit_die = try st.allocator().create(try parseDie(st, abbrev_table, is_64));
|
||||
|
||||
if (compile_unit_die.tag_id != DW.TAG_compile_unit) return error.InvalidDebugInfo;
|
||||
|
||||
|
|
|
@ -194,9 +194,9 @@ fn BaseLinkedList(comptime T: type, comptime ParentType: type, comptime field_na
|
|||
pub fn allocateNode(list: *Self, allocator: *Allocator) !*Node {
|
||||
comptime assert(!isIntrusive());
|
||||
return allocator.create(Node{
|
||||
.prev = null,
|
||||
.next = null,
|
||||
.data = undefined
|
||||
.prev = null,
|
||||
.next = null,
|
||||
.data = undefined,
|
||||
});
|
||||
}
|
||||
|
||||
|
|
|
@ -44,7 +44,7 @@ pub const Allocator = struct {
|
|||
/// Alias of `create`
|
||||
/// Call `destroy` with the result
|
||||
pub fn construct(self: *Allocator, init: var) Error!*@typeOf(init) {
|
||||
return self.create(init);
|
||||
return self.create(init);
|
||||
}
|
||||
|
||||
/// `ptr` should be the return value of `construct` or `create`
|
||||
|
|
|
@ -2583,8 +2583,8 @@ pub fn spawnThread(context: var, comptime startFn: var) SpawnThreadError!*Thread
|
|||
errdefer assert(windows.HeapFree(heap_handle, 0, bytes_ptr) != 0);
|
||||
const bytes = @ptrCast([*]u8, bytes_ptr)[0..byte_count];
|
||||
const outer_context = std.heap.FixedBufferAllocator.init(bytes).allocator.create(WinThread.OuterContext{
|
||||
.thread = undefined,
|
||||
.inner = context
|
||||
.thread = undefined,
|
||||
.inner = context,
|
||||
}) catch unreachable;
|
||||
|
||||
outer_context.thread.data.heap_handle = heap_handle;
|
||||
|
|
|
@ -146,7 +146,7 @@ test "null with default unwrap" {
|
|||
|
||||
test "optional types" {
|
||||
comptime {
|
||||
const opt_type_struct = StructWithOptionalType { .t=u8, };
|
||||
const opt_type_struct = StructWithOptionalType{ .t = u8 };
|
||||
assert(opt_type_struct.t != null and opt_type_struct.t.? == u8);
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue