diff options
| author | Andrew Kelley <andrew@ziglang.org> | 2021-11-30 18:48:31 -0800 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2021-11-30 18:48:31 -0800 |
| commit | 7355a201336c8e3892427e5932fe5cdd46cf96df (patch) | |
| tree | 4ccec922634586847d02f2324d0db75f25200188 /lib/std/bit_set.zig | |
| parent | dd62a6d2e8de522187fd096354e7156cca1821c5 (diff) | |
| parent | 066eaa5e9cbfde172449f6d95bb884c7d86ac10c (diff) | |
| download | zig-7355a201336c8e3892427e5932fe5cdd46cf96df.tar.gz zig-7355a201336c8e3892427e5932fe5cdd46cf96df.zip | |
Merge pull request #10055 from leecannon/allocator_refactor
Allocgate
Diffstat (limited to 'lib/std/bit_set.zig')
| -rw-r--r-- | lib/std/bit_set.zig | 18 |
1 files changed, 9 insertions, 9 deletions
diff --git a/lib/std/bit_set.zig b/lib/std/bit_set.zig index af960784f7..2848305819 100644 --- a/lib/std/bit_set.zig +++ b/lib/std/bit_set.zig @@ -476,7 +476,7 @@ pub const DynamicBitSetUnmanaged = struct { /// Creates a bit set with no elements present. /// If bit_length is not zero, deinit must eventually be called. - pub fn initEmpty(bit_length: usize, allocator: *Allocator) !Self { + pub fn initEmpty(bit_length: usize, allocator: Allocator) !Self { var self = Self{}; try self.resize(bit_length, false, allocator); return self; @@ -484,7 +484,7 @@ pub const DynamicBitSetUnmanaged = struct { /// Creates a bit set with all elements present. /// If bit_length is not zero, deinit must eventually be called. - pub fn initFull(bit_length: usize, allocator: *Allocator) !Self { + pub fn initFull(bit_length: usize, allocator: Allocator) !Self { var self = Self{}; try self.resize(bit_length, true, allocator); return self; @@ -493,7 +493,7 @@ pub const DynamicBitSetUnmanaged = struct { /// Resizes to a new bit_length. If the new length is larger /// than the old length, fills any added bits with `fill`. /// If new_len is not zero, deinit must eventually be called. - pub fn resize(self: *@This(), new_len: usize, fill: bool, allocator: *Allocator) !void { + pub fn resize(self: *@This(), new_len: usize, fill: bool, allocator: Allocator) !void { const old_len = self.bit_length; const old_masks = numMasks(old_len); @@ -556,12 +556,12 @@ pub const DynamicBitSetUnmanaged = struct { /// deinitializes the array and releases its memory. /// The passed allocator must be the same one used for /// init* or resize in the past. - pub fn deinit(self: *Self, allocator: *Allocator) void { + pub fn deinit(self: *Self, allocator: Allocator) void { self.resize(0, false, allocator) catch unreachable; } /// Creates a duplicate of this bit set, using the new allocator. - pub fn clone(self: *const Self, new_allocator: *Allocator) !Self { + pub fn clone(self: *const Self, new_allocator: Allocator) !Self { const num_masks = numMasks(self.bit_length); var copy = Self{}; try copy.resize(self.bit_length, false, new_allocator); @@ -742,13 +742,13 @@ pub const DynamicBitSet = struct { pub const ShiftInt = std.math.Log2Int(MaskInt); /// The allocator used by this bit set - allocator: *Allocator, + allocator: Allocator, /// The number of valid items in this bit set unmanaged: DynamicBitSetUnmanaged = .{}, /// Creates a bit set with no elements present. - pub fn initEmpty(bit_length: usize, allocator: *Allocator) !Self { + pub fn initEmpty(bit_length: usize, allocator: Allocator) !Self { return Self{ .unmanaged = try DynamicBitSetUnmanaged.initEmpty(bit_length, allocator), .allocator = allocator, @@ -756,7 +756,7 @@ pub const DynamicBitSet = struct { } /// Creates a bit set with all elements present. - pub fn initFull(bit_length: usize, allocator: *Allocator) !Self { + pub fn initFull(bit_length: usize, allocator: Allocator) !Self { return Self{ .unmanaged = try DynamicBitSetUnmanaged.initFull(bit_length, allocator), .allocator = allocator, @@ -777,7 +777,7 @@ pub const DynamicBitSet = struct { } /// Creates a duplicate of this bit set, using the new allocator. - pub fn clone(self: *const Self, new_allocator: *Allocator) !Self { + pub fn clone(self: *const Self, new_allocator: Allocator) !Self { return Self{ .unmanaged = try self.unmanaged.clone(new_allocator), .allocator = new_allocator, |
