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/cstr.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/cstr.zig')
| -rw-r--r-- | lib/std/cstr.zig | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/lib/std/cstr.zig b/lib/std/cstr.zig index 64beb378d9..068fc419ac 100644 --- a/lib/std/cstr.zig +++ b/lib/std/cstr.zig @@ -33,7 +33,7 @@ fn testCStrFnsImpl() !void { /// Returns a mutable, null-terminated slice with the same length as `slice`. /// Caller owns the returned memory. -pub fn addNullByte(allocator: *mem.Allocator, slice: []const u8) ![:0]u8 { +pub fn addNullByte(allocator: mem.Allocator, slice: []const u8) ![:0]u8 { const result = try allocator.alloc(u8, slice.len + 1); mem.copy(u8, result, slice); result[slice.len] = 0; @@ -48,13 +48,13 @@ test "addNullByte" { } pub const NullTerminated2DArray = struct { - allocator: *mem.Allocator, + allocator: mem.Allocator, byte_count: usize, ptr: ?[*:null]?[*:0]u8, /// Takes N lists of strings, concatenates the lists together, and adds a null terminator /// Caller must deinit result - pub fn fromSlices(allocator: *mem.Allocator, slices: []const []const []const u8) !NullTerminated2DArray { + pub fn fromSlices(allocator: mem.Allocator, slices: []const []const []const u8) !NullTerminated2DArray { var new_len: usize = 1; // 1 for the list null var byte_count: usize = 0; for (slices) |slice| { |
